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 the name "node1",  and 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

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...

What is the best suitable configuration for serving static content?

The out of box configuration should be good enough.If I/O wait is high, try enabling Asynchronous...