tracd behind an apache2 proxy
This is the setup (click on the image for a larger version):
The idea is pretty basic, there is an Apache server running with SSL support and accepting requests for https://my.publicname.com. It is configured to act as a reverse proxy for the server running tracd behind it, accepting requests for http://192.168.1.2:8000.
So, in the example someone could open up a browser, put https://my.publicaddress.com/project 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/(.*) \ http://192.168.1.2:8000/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 http://192.168.1.1:8000/project/ticket/(ticketnumber) instead of https://my.publicaddress.com/project/ticket/(ticketnumber). 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.