Redirecting the Access Gateway to the Full Domain Name

By: BAndries

October 24, 2007 3:20 am

Reads: 171




If web services are configured for an internal network, where all the machines are member of the same DNS domain, you can easily reach all the web services by only specifying the host name in the browser, without specifying the domain name.

The Access Gateway requires you to specify the domain name when trying to reach the accelerated web service – otherwise, you’ll receive an error from the Access Gateway. With some easy modifications to the error page, you can redirect a browser that is accessing the web service by specifying only the host name to the full domain name.

Figure 1 – Error: “Host name received is not for this web site”


For this example, we’ll use “” as the full domain name. The host name in the example is “nam3-lab”, and the domain name is “”. This example will show how to modify the error page. It contains some reference code that can be changed according to your preferences.

First, you need to locate the error page. You can find this on the Access Gateway servers in this folder:


The error page is called “error.jsp”.


Use the following three steps to modify the error page:

1. Add Java code to the jsp page to detect if the error is caused by host name mismatch and that the browser is using only host name to connect.

String onload = "";
String host = "";
if(statusCode.matches("403") == true)
        onload = "";
        host = request.getServerName();
        String isFullName = host.indexOf(".")+"" ;
        if(isFullName.equals("-1") == true)
                        onload = "redirect()";

2. Add JavaScript to the page to redirect the browser, as shown below.

	function redirect(){

The browser will call this script when a redirect to the full domain name is needed. The host name is derived from the browser request, and the domain name is defined statically in the script.

3. Change the body to include the onload event:

<body leftmargin="0" topmargin="0" rightmargin="0" marginheight="0" marginwidth="0" onload="<%=onload%>">

When users now accesses http://nam3-lab, they will be automatically redirected to, and the error message will not displayed.

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

Categories: Uncategorized

Disclaimer: As with everything else at NetIQ Cool Solutions, this content is definitely not supported by NetIQ, so Customer Support will not be able to help you if it has any adverse effect on your environment.  It just worked for at least one person, and perhaps it will be useful for you too.  Be sure to test in a non-production environment.