Lighttpd proxy with X-Sendfile and action_cache

November 13, 2006 Link to post  Permalink

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:

1SERVER["socket"] == ":2200" {
2  setenv.add-request-header = ( "X_ENABLE_X_SENDFILE" => "true" )
3  proxy-core.allow-x-sendfile = "enable"
4  proxy-core.balancer = "sqf"
5  proxy-core.protocol = "http"
6  proxy-core.backends = ( "", "" )