Submit button POST generates a 303 which uses hostname instead of base_url
|Reported by:||Owned by:||Jonas Borgström|
We have trac (0.11b) setup on a machine behind an apache reverse proxy. I'll call the machines trac and rp. The trac machine is called trac.domain.net (internal hostname) and the rp has trac.domain.com pointing at its external IP. When a client is (for example) setting Preferences and clicks the submit button, the sequence is:
- Webclient sends POST to public hostname (rp), which sends POST to trac using internal hostname.
- trac generates a 303 to the rp, but the 303 contains the internal hostname instead of the one defined in trac.ini base_url.
- Webclient sends next GET to internal hostname instead of to public hostname.
This seems to happen repeatably on the Preferences screen, and with irregularity on the regular Wiki parts, so I think it's more than just the Preferences submit button.
If I'm needed interactively, I also hang out in IRC on freenode in #trac as cannonball, 7AM-4PM PST8PDT.
This can be fixed at the reverse proxy by setting the ProxyPassReverse on the rp, but the issue is that trac should 303 to the base_url instead of to the hostname. The fix on the rp is to detect all instances of the internal hostname and rewrite it to generic path, at which point the browser will substitute the public hostname in the appropriate places. Here's how:
ProxyPassReverse /project http://trac.domain.net/project