Sun Java System Web Proxy Server 4.0.3 2006Q2 Administration Guide

Virtual Multihosting in Reverse Proxy

Virtual multihosting is a feature which allows an origin server, or in our case, a reverse proxy server, to respond to multiple DNS aliases as if there was a different server installed in each of those addresses. As an example, you could have the DNS host names:

Each of them could be mapped to the same IP address (the IP address of the reverse proxy). You could then have the reverse proxy act differently based on which DNS name was used to access it.

Virtual Multihosting allows you to host multiple different *domains* in a single reverse proxy server as well. For example:

Note that you can have a combination of multiple local host names as well as multiple domains, all in a single proxy server:

This section contains the following topics:

Functional Details of Virtual Multihosting

The virtual multihosting feature works by specifying the DNS host and domain names (or aliases), and then giving a target URL prefix where requests sent to that host name should be directed. As an example, you can have two mappings:

Mappings do not have to go root-to-root; you may specify an additional URL path prefix in the target URL:

Same applies to virtual domain mappings. For example, you could use:

The system will look at the HTTP “Host:” header, and based on that header, it will choose the matching Virtual Multihosting mapping. If none of the multihosting mappings match, the server will continue looking at other mappings in the order that they appear in the configuration file, or perform no mappings if no matches are found. If there are no matches, the proxy will typically respond with the “Proxy denies fulfilling the request” response.

ProcedureTo configure virtual multihosting

Steps
  1. Access the Server Manager and click the URLs tab.

  2. Click the Configure Virtual Multihosting link.

    The Configure Virtual Multihosting page displays.

  3. In the Source Hostname (alias) field, specify the local host name (or DNS alias) that this mapping should apply to.

  4. In the Source Domain Name field, enter the local domain name that this mapping should apply to.

    Typically, this is your own network’s domain name, unless you want to multi-host multiple different DNS domains.

  5. In the Destination URL Prefix field, enter the target URL prefix where the request will be directed if the host and domain names match the above specifications.

  6. If you are using templates, choose the template name from the Use This Template drop-down list, or leave the value at “NONE” if you do not want to apply a template.

  7. Click OK.

  8. Click Restart Required.

    The Apply Changes page displays.

  9. Click the Restart Proxy Server button to apply the changes.

    Repeat the above steps for each virtual multihosting mapping you want to establish.

    All virtual multihosting mappings appear on the bottom of the Configure Virtual Multihosting page. Note that the Source Hostname (alias) and Source Domain Name fields are merged, together with the proxy’s port number, into a single regular expression that is used to match the “Host:” header.

    For example, if you have host name “www”, domain “example.com”, and port number “8080”, it will display the regular expression:

    www(|.example.com)(|:8080)

    This will guarantee a match with all of the following possible combinations that the user may have typed, or the client may have sent (the port number may be omitted by some client software even when it’s non-80, as it is obvious to the server which port number it was listening on):

    • www

    • www:8080

    • www.example.com

    • www.example.com:8080

Important Notes on Virtual Multihosting

You will need to disable the Client autoconfiguration feature before you can configure reverse proxy mappings. Doing so will not cause any problems because the Client autoconfiguration feature is for the forward proxy operation, not reverse proxy.

The Virtual Multihosting feature establishes automatic reverse mappings. In other words, do not create reverse mappings for mappings that you enter using the Virtual Multihosting page.

Virtual mappings are specified with virt-map function in obj.conf.

Virtual mappings are matched in the order specified in the obj.conf configuration file. If there are regular, reverse, regular expression, or client autoconfiguration mappings before the virtual mappings, they will be applied first. Similarly, if no matches are found in virtual mappings, translation will continue to the next mapping after the virtual mapping section in obj.conf.

If the port number of the proxy server is changed, you will need to recreate the Virtual Multihosting mappings, as they now have the wrong port number.