Special environment variables in LiteSpeed Rewrite Rules

The following are the Special Environment Variables that can be used in rewrite rules to control features:

dontlog
Once set, skips access logging, the value does not matter, for example:
RewriteRule \.gif - [E=dontlog:1]

nokeepalive
Closes the client's connection after finishing this request, the value does not matter, for example:
RewriteRule .* - [E=nokeepalive:1]

no-gzip
Do not use gzip compression for this request, must be set to a non-zero value, for example:
RewriteRule \.css - [E=no-gzip:1]
no-gzip:0 has no effect.

Proxy-Host
Modify proxy request "Host" header value, for example:
A web site's domain name is "www.example.com", it sends a proxy request to the backend, the backend is defined as a web server with name "node1", it requires the domain name to be "www.example.com", the rewrite rule should be
RewriteRule ^(.*)$ http://node1/$1 [P,E=Proxy-Host:www.example.com]

cache-ctrl/cache-control
Modify LSWS page cache policy
enable cache
Rewriterule ^/special_cachable_url$ - [E=Cache-ctrl:max-ages=30]
Rewriterule ^/non-cacheable-url$ - [E=Cache-control:no-cache]

No abort
This flag prevents external app processes from being killed by LSWS as a runaway process while it is in the middle of processing.
RewriteRule ^script_url$ - [E=noabort:1]

  • Variables, Rewrite Rules
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

What is the best suitable configuration for serving a static server?

The out of box configuration should be good enough. If I/O wait is high, choose 4.1RC4 (as of...

How do I use asynchronized disk I/O (AIO) and what are the benefits of it?

AIO will help a lot for servers with a high I/O wait, like CDN servers. If a server's I/O wait is...