#server.modules += ( "mod_rewrite") # Workaround to have a working reverse-proxy that matches an URL does URL rewriting in Ligghtpd. # # Ligtthpd 1.4.28 cannot perform both matching and URL rewriting at the same time. # Therefore we need to define 2 proxies, one does the matching and bounce the request # to the other one, in charge of rewriting the URL before proxying the request to the target server. # # More about this here: # http://redmine.lighttpd.net/issues/164#note-9 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # $HTTP["url"] =~ /servername/path # => 127.0.0.1:82 (rewrite : remove "/servername") # => servername:80/path #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Matching Proxy # $HTTP["url"] =~ "(^/servername/)" { proxy.server = ( "" => ( "servername:80" => # name ( "host" => "127.0.0.1", "port" => 82 ) ) ) } # URL Rewriting Proxy # $SERVER["socket"] == ":82" { url.rewrite-once = ( "^/servername/(.*)$" => "/$1" ) proxy.server = ( "" => ( "servername:82" => # name ( "host" => "10.0.0.1", # Set the IP address of servername "port" => 80 ) ) ) }