Skip to main content

Making a CSP Page the Home Page for the Web Server

Making a CSP Page the Home Page for the Web Server

This section describes how to set CSP page as the web server’s default page (or home page). As an example, the procedure for making the CSP samples menu (/csp/samples/menu.csp) the server’s default page is described. The web server’s default page is accessed via:

http://<web_server>/

Note that when a CSP page is served in this way, embedded URLs must be specified in full. If relative URLs are used for embedded hyperlinks, the browser interprets these as relative to the documentation root directory and not the CSP root. For example, taking our samples menu as the home page, the URL to, say, the inspector option should be:

http://<web_server>/csp/samples/inspector.csp

If relative URLs are used, then the browser incorrectly interprets this link as:

http://<web_server>/inspector.csp

Internet Information Services

  1. Open the Internet Services Manager window.

  2. In the left-hand window, navigate to the Default Web Site.

  3. Right-click Default Web Site and select Properties from the menu to display the Default Web Site Properties window.

  4. Select the Documents tab.

  5. Select Add to display the Add Default Document Name window.

  6. Enter the document name (/csp/samples/menu.csp) for the Default Document Name window.

  7. Select OK .

  8. Ensure that the Enable Default Document check box is selected.

  9. In the Directories tab, use the arrow keys to move the new default document (/csp/samples/menu.csp) to the top of the list.

  10. Select Apply and OK to save and activate all changes.

The new default page (/csp/samples/menu.csp) must physically exist relative to the web server’s documentation root directory. It is only necessary to create an empty file. For example, if your document’s root is c:\inetpub\wwwroot proceed as follows:

cd c:\inetpub\wwwroot
md csp
cd csp
md samples
cd samples
copy con menu.csp
^Z

Sun Web Servers

The procedure described in this section is only available with Gateway build 663.763 (and later).

The following directive specifies the home page for a Sun server in the default section of obj.conf:

NameTrans fn="home-page" path="/csp/samples/menu.csp"

This directive, however, does not result in the CSP form menu.csp becoming the home page for the server. The reason for this is that the server does not update the environment variables relating to the page requested before transferring control to the CSP Gateway. The Gateway sees the incoming request as a request for / instead of /csp/samples/menu.csp. Netscape-based servers expect NSAPI extensions to accept the responsibility for recognizing this scenario and update the variables identifying the page requested and its path accordingly. You can work around this behavior as follows:

  1. Define the CSP home page in the default section of obj.conf:

    NameTrans fn="home-page" path="/csp/samples/menu.csp"

  2. The section that describes the mapping between CSP files and the Gateway modules must be modified to include the home-page-path directive as follows:

    <Object ppath="*/*.[Cc][Ss][Pp]">
    Service method=(GET|HEAD|POST) fn=csp_req home-page-path="/cache-install-dir/csp/samples" 
    </Object> \
    <Object ppath="*/*.[Cc][Ll][Ss]">
    Service method=(GET|HEAD|POST) fn=csp_req home-page-path="/cache-install-dir/csp/samples" 
    </Object> \
    <Object ppath="*/*.[Zz][Ee][Nn]">
    Service method=(GET|HEAD|POST) fn=csp_req home-page-path="/cache-install-dir/csp/samples"
    </Object> 
    <Object ppath="*/CSPn3Sys.so">
    Service method=(GET|HEAD|POST) fn=csp_req_sys
    </Object> 
    <Object ppath="*/CSPn3.so">
    Service method=(GET|HEAD|POST) fn=csp_req
    </Object>
    
    

It is not entirely necessary to specify the path to the home page in the home-page-path property within the Service directive, but if you do, it results in the PATH_TRANSLATED environment variable taking the value that it would have done had /csp/samples/menu.csp been requested directly. In other words, PATH_TRANSLATED for the home-page (/) is returned as:

/install-dir/csp/samples/inspector.csp

instead of:

/csp/samples/inspector.csp

Apache Servers

Find the DirectoryIndex directive in the Apache configuration file. For example:

DirectoryIndex index.html index.html.var

Add the new default page for the web server at the head of the list:

DirectoryIndex /csp/samples/menu.csp index.html index.html.var
FeedbackOpens in a new tab