Setup LSWS as cache reverse proxy

LSWS can be setup as reverse proxy since earlier version (2.0). It can integrate with built-in cache to provide cache reverse proxy. This setup extends the benefit of LSCache for backends that are not necessarily using LSWS. It also provides the benefit of LSWS anti-ddos as well.

1. Create Web Server External App

      Admin CP => Configuration => Server => External App        
         Type: Web Server
         Name: test-proxy
         Max Connections: 150
         Initial Request Timeout (secs): 60
         Retry Timeout (secs): 0

Web Server type external app


  • Max Connections is for 1-CPU core. In other words, for a Web Host Professional license, the total Max Conn is 300 (150×2).

2. Create vhost for the proxy service

      Admin CP => Configuration => Virtual Hosts
             Virtual Host Name: proxy-vhost
             Virtual Host Root: $SERVER_ROOT/proxy/
             Config File: $VH_ROOT/conf/vhconf.xml
             Max Keep-Alive Requests: 1000
             Follow Symbolic Link: No
             Enable Scripts/ExtApps: No
             Restrained: Yes
           Leave default for the rest.
             Document Root: $VH_ROOT/html/

vhost general section

3. Create vhost level context

       Admin CP => Configuration => Virtual Hosts => Context
          Type: proxy
          URI: exp: /*
          Web Server: [Server Level]: test-proxy
          Leave default for the rest.

vhost level context

4. Map vhost to listener

5. Enable cache for the vhost (proxy)

5a. Enable cache at Server Level enable cache at server

5b. Set up cache policy at vhost Level vhost cache policy

6. Enable Per Client throttling for vhost (for http level anti-ddos)

vhost per client throttling


  1. Some of the configuration settings (vhost name, IP addresses, etc) shown in the screenshots are meant for illustration purposes only.
  2. The set up has been tested and worked on a production server running varnish+nginx+tomcat+postgresql, being able to defend 20000 requests/sec HTTP ddos attacks (with LiteSpeed Advance Anti-DDoS setup).
  3. Above setup can be easily extended to support proxy'ing multiple backends with each vhost (with its own web server type context) per each backend.
  4. The setup mentioned above can easily be extended to support load balancing multiple backends by creating a loadbalancer context at vhost level based on a loadbalancer external app (server or vhost level) with proxy::backend* being its worker.
  • Admin
  • Last modified: 2019/05/16 21:25
  • by Kacey Schroeder