Lighttpd proxy with X-Sendfile and action_cache
If you use lighttpd as a proxy server, instead of using the FastCGI bindings, then you’ll find that my action_cache code to use X-Sendfile doesn’t work. The switch I was using to enable this feature was set in the process environment when lighttpd started the Rails process. The process isn’t started by lighttpd in the proxy case, so a new switch was needed.
I added a Request variable called HTTP_X_ENABLE_X_SENDFILE to do this. Set this to ‘true’, and X-Sendfile will be enabled for proxy requests.
I think this will only work with the new proxy code in the 1.5.0 lighttpd that Jan is currently working on. It still seems a little buggy, as I can’t get any response to the client with my settings:
$SERVER["socket"] == ":2200" {
setenv.add-request-header = ( "X_ENABLE_X_SENDFILE" => "true" )
proxy-core.allow-x-sendfile = "enable"
proxy-core.balancer = "sqf"
proxy-core.protocol = "http"
proxy-core.backends = ( "127.0.0.1:4000", "127.0.0.1:4001" )
}