Rewrite URL before passing to proxy Lighttpd

Posted by futureelite7 on Server Fault See other posts from Server Fault or by futureelite7
Published on 2010-04-26T08:22:02Z Indexed on 2010/04/26 8:24 UTC
Read the original article Hit count: 453

Hi,

I'm trying to setup a reverse proxy in lighttpd, such that all requests (and only those requests) under /mobile/video is redirected to the / directory of a secondary web server. This is pretty easy in apache, but I can't for the life of me figure out how to do so in lighttpd.

$HTTP["url"] =~ "^/wsmobile/video/" {
       url.rewrite-once = ( ".*" => "/test/" )
       proxy.server = ( "" => ( ( "host" =>  "210.200.144.26", "port" => 9091 ) ) )
}

I've tried using the http["url"] directive, but lighttpd simply ignore those requests and continue to pass the full url to the secondary server, which of course chokes and throws 404s. However, if I do a global rewrite then everything gets forwarded to the secondary server, which is also not what I want.

How do I go about this task?

© Server Fault or respective owner

Related posts about lighttpd

Related posts about mod-proxy