Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running lighttpd 1.5 freshly compiled off svn.

I have a trac daemon listening on port 8000 and I want to proxy all requests matching ^http://xx.xx.xx.xx/trac(*.) to that daemon.

Here is what it looks like in my .conf:

$HTTP["host"] == "xx.xx.xx.xx" {
$HTTP["url"] =~ "^/trac" {
    proxy-core.balancer = "round-robin"
    proxy-core.protocol = "http"
    proxy-core.backends = ( "" )
    proxy-core.rewrite-response = (
        "Location" => ( "^http://xx\.xx\.xx\.xx/(.*)" => http://xx.xx.xx.xx/trac/$1" ),
proxy-core.rewrite-request = (
    "_uri" => ( "^/trac/?(.*)" => "/$1" ),
    "Host" => ( ".*" => "xx.xx.xx.xx" ),


xx.xx.xx.xx is the publicly accessible IP, on port 80.

Part of that works because when I browse to http://xx.xx.xx.xx/trac I see my available projects in Trac (i.e. the page served by, whereas any other path not starting with /trac shows what it is supposed to, the content from docroot.

My only issue is that links on that page point to http://xx.xx.xx.xx/projectname, whereas they are supposed to point to http://xx.xx.xx.xx/trac/projectname. If I type http://xx.xx.xx.xx/trac/projectname manually in the url bar, I get the right page from Trac (, that is the homepage for that project), but with all links/images/stylesheets/etc. broken and pointing to http://xx.xx.xx.xx/projectname/* instead of http://xx.xx.xx.xx/trac/projectname.

I would like to know how to remedy to that problem, judging from the reverse-proxy code from the wiki I thought I could have used it for that, but I seem unable to rewrite any link or resource (images/stylesheets/etc.).

In case it matters, all paths in the pages returned by the trac daemon are relative. (starting at /projectname)

Also, this is the response I get in Firefox:

Status=OK - 200
Server=tracd/0.12.1 Python/2.5.2
Date=Fri, 04 Feb 2011 00:30:07 GMT

Thank you for your help!

share|improve this question
I ended up using trac's --base-path switch to get it working. – Mathieu M-Gosselin Feb 11 '11 at 2:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.