Opened 14 years ago
Closed 14 years ago
#9586 closed enhancement (duplicate)
base_url with multiple environments (tracd)
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | general | Version: | 0.11.6 |
Severity: | normal | Keywords: | base_url |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
Context: I'm using Trac 11.6 from OpenBSD's ports. tracd
manages several environments using the -e
flag. Trac runs behind an Apache proxy which redirects every request to /svn to Trac. For consistency and to simplify proxying rules, Trac serves the content from an identical base path (--base-path
) of /svn.
All the environments inherit from a global trac.ini which contains the following:
[trac] base_url = http://scm.domain.tld/svn/ use_base_url_for_redirect = True
While this may work for single-projects, when serving multiple environments, all of them inherit the same base_url
. They then create URLs respective to the Trac root rather than there own. For example, project1
will reference http://scm.domain.tld/svn/log?rev=1
, which doesn't exist, rather than http://scm.domain.tld/svn/project1/log?rev=1
.
Thus, I think it would be better to consider the base_url
to be the base URL from where Trac is accessible. Depending on the configuration, additional path components may be added to it:
- In single project configurations, the
base_url
can be used directly as it does reference the root of the project as well as that of Trac. - In multiple environment configuration, the path to the project should be added to the main
base_url
to actually build the project's base URLhttp://scm.domain.tld/svn/project1/
(rather that Trac'shttp://scm.domain.tld/svn/
).
This would allow for a more scalable configuration management where the server's base_url
is configured only once and each environment derives its own path from there.
Also, I noticed that when use_base_url_for_redirect="False"
, full URLS (e.g. in the RSS) still use 127.0.0.1, where I understood from the documentation that setting base_url
was sufficient to have them replaced, and use_base_url_for_redirect
was only necessary with redirect issues, but not document rewriting. Did I misunderstand? Should use_base_url_for_redirect
be set for document rewriting to work at all?
Attachments (0)
Change History (4)
comment:1 by , 14 years ago
Type: | defect → enhancement |
---|
comment:2 by , 14 years ago
comment:4 by , 14 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Indeed, it is a Duplicate of #7573. It didn't come up in my searches.
Thanks for the pointer !
Thinking a bit more about this issue, maybe changing the way
base_url
is interpreted is not a correct approach. One could imagine a scenario where two Trac environments served by the sametracd
are proxyed from two completely different URLS (sayhttp://www.site1.tld
andhttp://www.site2.tld/code
). Having a functionality modifying thebase_url
would mess everything up in that case (e.g.http://www.site2.tld/code/site2project
isn't desired).Maybe the best approach, then, is to add a new configuration directive
trac_base_url
which can be inherited, and do something like the following Python-like pseudocode.