lighty's life

lighty developer blog

X-Sendfile's New Friend: X-Rewrite-*

Today on IRC I got a question on:
Fobax can you x-send-file from fast-cgi to a proxy request?
Or asked in another way ?
Can you use a mod_proxy_core backend to rewrite a URL or a Host header ?
After 30 minutes of coding ... Yes, you can ...

Mod_proxy_core Got X-Sendfile Support

As promissed mod_proxy_core would combine the features from mod_proxy and mod_fastcgi. mod_proxy gave the balancers, mod_fastcgi gave its fail-over handling and now support for X-Sendfile.

Hash Balancing With Mod_proxy_core

mod_proxy and mod_proxy_core support 3 balancers to spread the load over multiple backends. One of them is Hash balancing which is very good for balancing the load of caching proxies like Squid. If you compare the performance of Hash-Balancing to the classic round-robin balancing you should see a increase of the performance as the backends can use their caches a lot better. With RR each backend has to handle the full URL namespace, with Hash-Balancing only a part. This increases the cache-locality and the overall performance.

Reverse-Proxying Mod_proxy_core

I just added and commited the header rewriting support for mod_proxy_core.
$HTTP["url"] =~ "^/proxyme(/|$)" {
  proxy-core.balancer = "round-robin"
  proxy-core.protocol = "http"
  proxy-core.backends = ( "" )
  proxy-core.rewrite-response = (
    "Location" => ( "^*)" => "$1" ),
  proxy-core.rewrite-request = (
    "_uri" => ( "^/proxyme/?(.*)" => "/$1" ),
    "Host" => ( ".*" => "" ),

Mod_proxy_core Commited to Svn

mod_proxy_core just got commited to SVN and is now available to testers.
server.modules = ( ..., "mod_proxy_core", .. )

## works
$HTTP["url"] =~ "^/proxyme/" {
  proxy-core.balancer = "round-robin"
  proxy-core.protocol = "http"
  proxy-core.backends = ( "" )

  ## to be done
  proxy-core.rewrite-response = (
    "Location" => ( 
      "^*)" => "$1" ) )
  proxy-core.rewrite-request = (
    "URI" => (
      "^/proxyme(/.*)" => "$1" ) )

The New Mod_proxy_core

One thing I heard from everyone at the railsconf was: __Please fix mod_proxy__. In my talk I presented a look into the future and how mod_proxy will evolve in lighty 1.5.x, unification of the backend-plugin, .,. Well, perhaps it will be a bit earlier than 1.5.0


... or the hidden secrets of lighty. X-Sendfile is one of the important, but mostly unknown features. Time to put the spot-light on it and see why you want to use it.

What I Learned at the Railsconf

The railsconf 2006 is over and it was a amazing week here in Chicago. Around 500 attendees made the conference a huge success. Inspiraring Keynotes, interesting lightning talks and a amazing show by 'Why the Lucky Stiff and the Thirsty Cups'.

Lighty on Win32

At the railsconf I spent some time to work on the native win32 port of lighty. Thanks to scons we already had a working build system on Windows, it only needed some #ifdef's to get the beast compiling.

Lighty at the Railsconf

I've just finished my presentation on lighty at the "railsconf": in Chicago, IL, USA. The slides of the presentation "Accelerating Rails with Lighty" have been uploaded to ""://