How to set up the server as a proxy via rewrite rules

  1. Log in to the LSWS GUI. The default address is http://IP:7080
  2. Go to Configuration → Virtual Hosts and click on the Virtual Host that is going to be used as the proxy.
  3. In the Virtual Host configuration, go to the External App tab and hit Add.
  4. Select Web Server from the drop down list.
  5. On the following page, fill in the following and hit Save:
    • Name - Any unique external app name. It should not start with
      http://
    • Address - The IP:PORT or UDS socket of the backend server. It cannot be a domain name.
    • Max Connections - The maximum number of concurrent connections to this Web Server at any time.
    • Initial Request Timeout (secs) - The maximum time in seconds the server will wait for a response.
    • Retry Timeout (secs) - The period of time that the server waits before retrying a request.
  6. After saving, go to the Rewrite Tab and hit Edit.
  7. Change the following and hit Save:
    • Enable Rewrite - Yes
      • Note: This allows the rewrite rules to be processed in .htaccess.
  8. After saving, go to the General Tab → HT Access and hit Edit.
    • Allow Override - Make sure all boxes are checked, except “None”.
    • Access File Name - Type in .htaccess
  9. Next, go to the Document Root and create a file named .htaccess.
  10. In Shell or an Editor, edit the .htaccess file and add the following:
    • RewriteRule (.*) http://<EXTERNAL_APP_NAME>/$1 [P]
      • Note: be sure to set it as a 1:1 copy of the External App made previously.
  11. Once all of the steps above have been completed, perform a Graceful Restart for the changes to take effect.

The URL for the vhost should now act as a proxy for the External App Web Server that was just set up.

  • Admin
  • Last modified: 2017/10/16 18:30
  • by Jackson Zhang