Sun Java System Web Server 7.0 Update 4 Administrator's Guide

Configuring Reverse Proxy for Load-balancing

Web Server 7.0 provides a sophisticated built-in load balancer, the reverse proxy, which distributes load or request from the client to several backend servers.

Web Server provides GUI and CLI support for configuring the reverse proxy.

ProcedureConfiguring Reverse Proxy Using Administration Console

  1. Install Web Server on the node that you want to use for configuring reverse proxy.

  2. Create a configuration. For example, rp.

  3. Using the Administration Console, select Configurations > Virtual Servers > Content Handling > Reverse Proxy tab. Click New.

  4. Specify values for the following parameters:

    • URI — The reverse proxy URI

    • Server URL — Comma separated server URLs of all the machines in the cluster separated by comma. If multiple values are given, the server will distribute load among the specified servers.

      The format for entering the server URL is hostname:portnumber. For example, http://<content server-hostname>:port

  5. Click the OK button.

  6. Click the Deployment Pending link in the top right of the screen to deploy the modified configuration and to apply changes to the configuration.

  7. Click the Deploy button.

    Deployment successful message appears.

  8. Start all instances of this modified configuration.

    This completes configuring the reverse proxy for load balancing HTTP requests.


    Note –

    To configure a reverse proxy in a cluster environment, issue a wildcard server certificate or the alternate subject names that can be set to the actual origin server host names. The other option of specifying the original server's host names in the subject name field limits the size of the cluster, leading the cluster to fail if another node is added to the cluster.

    A wildcard server certificate can be created using the administration interfaces. After creating the server certificate use certutil to get the base64 encoded version of the certificate and install it as a trusted CA certificate on the load balancer configuration.

    Type the following command to generate the base64 encoded certificate bash$./certutil -L -a -d instancedir/config. Copy the output of the command and paste it in the install certificate wizard.


ProcedureConfiguring Reverse Proxy Using CLI

Perform the following steps to configure reverse proxy in CLI mode. You will create a configuration config1 and an instance rp as reverse proxy.

  1. Start the Administration Server:

    $ <install-dir>/admin-server/bin/startserv

  2. Invoke the CLI shell:

    <install-dir>/admin-server/bin/wadm -user <username>

    You can see the wadm shell

  3. Create config1:

    wadm>create-config --http-port=8080 --server-name=config1 --server-user=root config1

  4. Create an instance for the config1 configuration:

    wadm>create-instance --config=config1 <host-name>

  5. Add the web application on the created configuration:

    wadm>add-webapp --config=config1 -vs=config1 --uri/test <warfile>

  6. Deploy the web application.

    wadm>deploy-config --user=admin --password-file=admin.pwd --host=serverhost --port=8989 config1

  7. Create a rp configuration:

    wadm>create-config --http-port=8081 --server-name=rp --server-user=root rp

  8. Enable the rp configuration to reverse proxy using the following command:


    wadm> create-reverse-proxy --user=admin --password-file=admin.pwd 
    --host=serverhost --config=rp --vs=rp --uri-prefix=// 
    --server=http://rick.india.sun.com:8080

    To redirect to a secure site, follow the same step and provide the https address for the --server option.

    See CLI Reference, create-reverse-proxy(1).

  9. Create an instance for the rp configuration.

    wadm>create-instance --config=rp <host-name>

  10. Start the instances:

    wadm>start-instance --config=config1 <host-name>

    wadm>start-instance --config=rp <hostname>

    The web application deployed in config1 can be viewed through rp instance.

    http://<rp instance hostname>:8081/test

    See CLI Reference, list-reverse-proxy-uris(1), set-reverse-proxy-prop(1), get-reverse-proxy-prop(1), forward-reverse-proxy-header(1), block-reverse-proxy-header(1), and list-reverse-proxy-headers(1)