An alternative method for accessing an application on multiple servers is to use virtual host arrangements. Virtual hosts are a common feature in Apache web server configurations and are straightforward to set up in this server environment. For example, consider two virtual hosts, each listening on a separate TCP port:
Virtual Hosts Overview
Virtual hosts are a means through which you can transparently serve applications on one or more instances through a common web server. Each server installation appears to operate as a separate web server.
The differentiating factor in virtual host setups can be one of the following:
-
Web server IP address — The server hosting the web server is exposed through two IP addresses. For example:
123.123.123.1 == www.serverA.com
123.123.123.2 == www.serverB.com
-
Web server port — This method is useful for testing different configurations, though it involves including the port number in the request for cases where non-standard TCP ports are used (TCP ports other than 80). For example:
Web Server TCP Port 80 == www.serverA.com
Web Server TCP Port 81 == www.serverB.com
-
Path — the preferred way of implementing virtual hosts. You register the two names and they translate to a single physical IP address for the web server. For example:
www.serverA.com == 123.123.123.1
www.serverB.com == 123.123.123.1
Regardless of which way you choose, set up a named slot for each InterSystems IRIS installation in the Web Gateway configuration (it does not need to be the same as the InterSystems IRIS instance name). The superserver port that the Web Gateway configuration (for each server) is pointing to is what is important.
For example:
www.serverA.com
www.serverB.com
Both are served by a single web server installation.
You can implement servers including mixtures of all three. Options 1 and 3 are identical from the browser perspective. You can configure each virtual host to have its own documents root, etc.
To extend the virtual host concept through to CSP, suppose you wish to run the same web application through two virtual hosts, but on different InterSystems IRIS instances. For example, one site for testing and another for production.
www.serverA.com/csp/login.csp ==> irisA
www.serverB.com/csp/login.csp ==> irisB
A web application’s access to an InterSystems IRIS server is controlled through the Web Gateway Application Access configuration option. Typically, the following two entries are defined:
The name of the InterSystems IRIS server is associated with these application path definitions:
/ (Default Server == irisA)
/csp (Default Server == irisA)
The Web Gateway allows you to extend this configuration to include the name of a virtual host through which you access the application.
/ (Default Server == irisA)
/csp (Default Server == irisA)
//www.serverA.com/csp (Default Server == irisA)
//www.serverB.com/csp (Default Server == irisB)
You can then configure a separate InterSystems IRIS server for www.serverA.com/csp and www.serverB.com/csp as shown above. Introduce server names by //, as shown.
The current rules of inheritance apply. For example, if you request www.serverA.com/xxx/yyy.csp, then the InterSystems IRIS server defined for / is ultimately used, unless, you define an ultimate default for serverA as shown below:
/ (Default Server == irisL)
/csp (Default Server == irisL)
//www.serverA.com/ (Default Server == irisL)
//www.serverA.com/csp (Default Server == irisA)
//www.serverB.com/csp (Default Server == irisB)
Note:
The servers specified in the Web Gateway configuration do not necessarily have to be virtual. For example, you can configure a single NSD installation to support several real Apache installations with a different set of InterSystems IRIS servers defined for each one. Further, you can configure each Apache server to support many virtual hosts.
The Web Gateway identifies the host for the application through the CGI environment variable SERVER_NAME.