Opened 18 years ago
Last modified 5 years ago
#1489 new enhancement
Get base url from environment
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Component: | ProjectMenuPlugin |
Severity: | normal | Keywords: | base_url reverseproxy |
Cc: | Trac Release: | 0.10 |
Description
Maybe it is better to get the base url from env
:
#base_url, _ = posixpath.split(req.abs_href()) base_url = self.env.base_url
With this the plugin works in my setup.
Attachments (0)
Change History (5)
comment:1 follow-up: 2 Changed 18 years ago by
comment:2 Changed 18 years ago by
Replying to coderanger:
This assumes
base_url
is set, which may not be the case in 0.10.req.abs_href
will be based onbase_url
if present, and if not it will try to auto-detect. What is the problem you get with the current code?
I set TracEnvParentDir
to /vol/trac
and TracUriRoot
to /projects
. The
Apache websever configuration file defines a /projects
location to acccess
the Trac project list. If I use your original code and try to switch from a
project A (www.my.server.com/projects/A
) to a project B
(www.my.server.com/projects/B
), the /projects/
part is missing and the browser is directed
to www.my.server.com/B
. Maybe my setup is wrong?
comment:3 Changed 17 years ago by
Keywords: | base_url reverseproxy added |
---|
Different, but related problem: the apache serving my tracs is behind a reverse proxy that does https and some path remapping. The public URL of a trac instance is https://trac.foo.com/parent/projectA/
; however, the backend webserver gets the request as http://trac.intra:2080/parent/projectA/
.
The ProjectMenuPlugin will send the browser to http://trac.intra:2080/parent/projectB/
if projectB is selected, instead of https://trac.foo.com/parent/projectB/
.
Maybe this is related to http://trac.edgewall.org/ticket/5064; the discussion got a bit convoluted, so I'm not sure. I'm using 0.10.4.
Using mod_proxy_html is a workaround, but I wouldn't call it a solution.
comment:4 Changed 10 years ago by
Owner: | changed from Noah Kantrowitz to Ryan J Ollos |
---|---|
Status: | new → assigned |
comment:5 Changed 5 years ago by
Owner: | Ryan J Ollos deleted |
---|---|
Status: | assigned → new |
This assumes
base_url
is set, which may not be the case in 0.10.req.abs_href
will be based onbase_url
if present, and if not it will try to auto-detect. What is the problem you get with the current code?