tracd behind an apache2 proxy
May 2022
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
This site is an effort to share some of the base knowledge I have gathered through all this years working with Linux, FreeBSD, OpenBSD, Python or Zope, among others. So, take a look around and I hope you will find the contents useful.
Recent Entries
Recent Comments
Recent Trackbacks
OpenBSD (9 items)
BSD (0 items)
FreeBSD (19 items)
Linux (3 items)
Security (3 items)
Python (22 items)
Zope (13 items)
Daily (144 items)
e-shell (9 items)
Hacks (14 items)
PostgreSQL (3 items)
OSX (8 items)
Nintendo DS (0 items)
enlightenment (0 items)
Apache (3 items)
Nintendo Wii (1 items)
Django (24 items)
Music (12 items)
Plone (7 items)
Varnish (0 items)
Lugo (2 items)
Sendmail (0 items)
europython (7 items)
Cherokee (1 items)
self (1 items)
Nature (1 items)
Hiking (0 items)
uwsgi (0 items)
nginx (0 items)
cycling (10 items)
Networking (1 items)
DNS (0 items)

Syndicate this site (XML)

RSS/RDF 0.91

05 febrero

tracd behind an apache2 proxy

wrong redirect after adding a ticket

I found this weird behaviour with tracd and an apache proxy today, while setting up some public trac access for one of our projects.

This is the setup (click on the image for a larger version):

tracd behind an apache 2.2 proxy

The idea is pretty basic, there is an Apache server running with SSL support and accepting requests for It is configured to act as a reverse proxy for the server running tracd behind it, accepting requests for

So, in the example someone could open up a browser, put in the address/location bar and access that project trac page. The process would be:

  • 1. A request is sent to the Apache server, which will accept it and process it using the following rule in the VirtualHost configuration:

    RewriteRule ^/project/(.*) \
      $1 [L,P]
  • 2. Another request is sent from Apache to tracd, asking for the needed data

  • 3. The data is sent back from tracd to Apache

  • 4. The data is sent back to the user, transparently (the user doesn't even know that there are more than one server serving the contents).

Nice!! but... it failed when I tried to add a ticket using a external connection. :(

Each time I tried to add a ticket, after it was added, my browser was redirected to instead of Ugly. It seemed like trac was building the url internally and, of course, that internal url will not work from outside.

After some read-and-try, I found that the problem could be solved editing my trac env trac.ini config file, and replacing:

base_url =

[ ... ]

use_base_url_for_redirect = False


base_url = /project

[ ... ]

use_base_url_for_redirect = True

This solved the problem, allowing me to use the trac instance from both within the LAN and from the outside.

Posted by wu at 16:24 | Comments (0) | Trackbacks (0)
<< Paris happiness | Main | NFS server behind a PF firewall >>
Re: tracd behind an apache2 proxy

Everybody who is proxying their web app through apache (or even other web servers) has this kind of problem. Zope solves it using the Virtual Host Monster, others have other mechanisms.

Apache also has the ProxyPassReverse directive to solve the same problem, but since it is much less flexible than rewrite rules, it often doesn't do the job.

Posted by: betabug at febrero 08,2010 09:44
Re: tracd behind an apache2 proxy

thanks for this good info

Posted by: Khaled at marzo 19,2014 22:20
Please send trackback to:
There are no trackbacks.
Post a comment