This is an old revision of the document!
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]
wait-req-full-body
When LSWS process request, it usually pass the request to backend (PHP) without waiting for the full request body to complete. Usually, it is not a problem, unless the script need the whole request body to work properly. Starting from 5.4.8 build 4, we added an environment variable to control this. It can be set via SetEnv, SetEnvIf or a rewrite rule.
RewriteRule ^(.*)$ [E=wait-req-full-body:1]
or
SetEnv wait-req-full-body 1