generating correct URLs for a ProxyPass setup ...

54 views
Skip to first unread message

SameerDS

unread,
Feb 19, 2007, 5:23:48 AM2/19/07
to Trac Users
Hi,

We have a setup where the location http://frontend/lab/trac is mapped
via ProxyPass to http://lab-backend/trac

In its default setup, trac generates links with URL's starting with "/
trac/something", which obviously get rendered as "http://frontend/trac/
something", and hence don't work.

>From another discussion in the archives, I realised "base_url" has
nothing to do with the links rendered in the wiki. So, I made a quick
hack that reads "base_path" from the ini file. Now it works ---
relative links are generated using the value in the ini file, "/lab/
trac" ... but I am not sure if this is the right way to do it ...

Sameer.

Rainer Sokoll

unread,
Feb 19, 2007, 5:55:43 AM2/19/07
to trac-...@googlegroups.com
On Mon, Feb 19, 2007 at 10:23:48AM -0000, SameerDS wrote:

> We have a setup where the location http://frontend/lab/trac is mapped
> via ProxyPass to http://lab-backend/trac

Probably you also need ProxyPassReverse.

Rainer

SameerDS

unread,
Feb 19, 2007, 7:51:09 AM2/19/07
to Trac Users
On Feb 19, 3:55 pm, Rainer Sokoll <R.Sok...@intershop.de> wrote:

> > We have a setup where the location http://frontend/lab/trac is mapped
> > via ProxyPass to http://lab-backend/trac
>
> Probably you also need ProxyPassReverse.

I don't think that will work ... ProxyPassReverse is used only for
server redirects, it cannot modify links within the generated HTML.
Here's an excerpt from the apache documentation:

http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypassreverse

"Only the HTTP response headers specifically mentioned above will
be rewritten. Apache will not rewrite other response headers, nor
will it rewrite URL references inside HTML pages. This means that
if
the proxied content contains absolute URL references, they will
by-pass the proxy."

My problem is with the href's seen by the browser, not the one's sent
to the server. All the links in trac start with a forward slash, such
as "/trac/wiki" ... if the initial slash were absent, things would
have worked, since the browser would then interpret them as "http://
frontend/lab/trac/wiki" instead of "http://frontend/trac/wiki". I
don't know if dropping that initial forward slash will break
anything ... hence the attempt at making "base_path" a config
variable.

Sameer.

SameerDS

unread,
Feb 19, 2007, 8:59:12 AM2/19/07
to Trac Users
On Feb 19, 5:51 pm, "SameerDS" <samee...@gmail.com> wrote:

> My problem is with the href's seen by the browser, not the one's sent
> to the server. All the links in trac start with a forward slash, such
> as "/trac/wiki" ... if the initial slash were absent, things would
> have worked, since the browser would then interpret them as

> "http://frontend/lab/trac/wiki" instead of "http://frontend/trac/wiki". I


> don't know if dropping that initial forward slash will break
> anything ... hence the attempt at making "base_path" a config
> variable.

Just to put some more light on the situation, here's what we are
looking for --- it's the corresponding variable that we set in
dokuwiki, on the same pair of servers.

http://wiki.splitbrain.org/wiki%3Aconfig#basedir

basedir

Usually DokuWiki can detect the directory that it is installed in
on its own. But sometimes this does not work for various
reasons. If DokuWiki does not seem to function properly and
cannot find things such as images for its web pages, you can
set the directory here.

The path you should set here, is the path from the server root
to your DokuWiki installation. Eg. if your wiki is available at
http://www.yourserver.com/dokuwiki/ you should set basedir
to /dokuwiki/. Be sure to have a leading and a trailing slash!

>
> Sameer.

Noah Kantrowitz

unread,
Feb 19, 2007, 1:21:25 PM2/19/07
to trac-...@googlegroups.com
If you are using mod_python, "PythonOption TracUriRoot /trac".

--Noah

Aaron D. Marasco

unread,
Feb 19, 2007, 6:13:25 PM2/19/07
to trac-...@googlegroups.com

On Mon, February 19, 2007 08:59, SameerDS wrote:
>
> On Feb 19, 5:51 pm, "SameerDS" <samee...@gmail.com> wrote:
>
>> My problem is with the href's seen by the browser, not the one's sent
>> to the server. All the links in trac start with a forward slash, such
>> as "/trac/wiki" ... if the initial slash were absent, things would
>> have worked, since the browser would then interpret them as
>> "http://frontend/lab/trac/wiki" instead of "http://frontend/trac/wiki".
>> I
>> don't know if dropping that initial forward slash will break
>> anything ... hence the attempt at making "base_path" a config
>> variable.

I have trac using an Apache 1.3x proxy in front of it.

In trac.ini I have

[trac]
base_url = http://blog.revragnarok.com/blog/
[project]
url = http://blog.revragnarok.com/

On the other machine in httpd.conf:
<VirtualHost EXTIP:80>
ServerName blog.revragnarok.com
ProxyPass / http://internal_machine_name/
ProxyPassReverse / http://internal_machine_name/
</VirtualHost>

- Aaron

--
Sent using a web interface, so I am sending this instead of working.

Reply all
Reply to author
Forward
0 new messages