Opened 18 years ago
Closed 3 years ago
#4103 closed defect (wontfix)
TracUriRoot ignored (?!) on index-page
Reported by: | franetic | Owned by: | Christopher Lenz |
---|---|---|---|
Priority: | lowest | Milestone: | |
Component: | web frontend/mod_python | Version: | 0.10.4 |
Severity: | minor | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
I used this config in Apache with Trac 0.9.x
<Location "/"> SetHandler mod_python PythonHandler trac.web.modpython_frontend ... PythonOption TracUriRoot / PythonOption TracEnvIndexTemplate C:\trac_templates\index.cs PythonOption TracTemplateVars lang=de,index=1 </Location> <Location "/en"> SetHandler mod_python PythonHandler trac.web.modpython_frontend ... PythonOption TracUriRoot / PythonOption TracEnvIndexTemplate C:\trac_templates\index.cs PythonOption TracTemplateVars lang=en,index=1 </Location>
You shall notice here the TracUriRoot. For both configs the same. Differences are the Location and TracTemplateVars. This way I could send language-dependent index-content and the URIs of the projects remain always the same!
Now, this does not work with 0.10 release. I get: "Environment not found" (main.py:338) upon calling the location "/en". (I think the location "/" processes this "/en" request, but cannot really say it)
If TracUriRoot is also set to "/en" then it works of course… but then I have 2 URIs for a project respectively. (/project and /en/project)
I feel this as broken in Trac.
Attachments (0)
Change History (12)
comment:1 by , 18 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 18 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
That is not correct, that certainly works in Apache just fine. The lower config will take priority for any request under /en. I think the problem is that Trac doesn't expect you to lie about the URI root.
follow-up: 4 comment:3 by , 18 years ago
As I said it worked fine with 0.9.x but not with 0.10.x under Apache 2.0.5x.
I see that request processing were changed in Trac in the latter release.
1/ It first checks whether the request uri is at least in the same location. (source:tags/trac-0.10/trac/web/main.py@4189#L278). This is true.
2/ but the request shall NOT proceed (source:tags/trac-0.10/trac/web/main.py@4189#L318). It passes because it will be assumed to be a TracProject. Because it is below TracUriRoot :).
3/ this request dies at lines main.py#L336-338
So, I was wrong. The location "/en" processes the request "/en" of course.
0.9.x assumed if env cannot be opened then the index-page shall be sent (source:/tags/trac-0.9.6/trac/web/modpython_frontend.py@latest#L199)
But how to come around this respecting the TracUriRoot at the same time in 0.10?
comment:4 by , 17 years ago
Version: | 0.10 → 0.10.4 |
---|
Had same result ("Environment not found" from http://trac.edgewall.org/browser/tags/trac-0.10.4/trac/web/main.py#L379) when creating project using CreateProj 0.1 plugin and no TracUriRoot hack.
I'm using Trac 0.10.4 (stable) running in standalone mode (tracd) with proxy rewrite rule in Apache.
Traced problem to http://trac.edgewall.org/browser/tags/trac-0.10.4/trac/web/main.py#L357, that is env_name
variable, which contains "http:"
string, this value is taken from first (zero index) item of list
path_info = environ.get('PATH_INFO', '').lstrip('/').split('/')
(http://trac.edgewall.org/browser/tags/trac-0.10.4/trac/web/main.py#L356)
which has value ['http:', 'test']
and this is the problem, env_name
should NOT contain protocol but directory name (see it's usage on lines http://trac.edgewall.org/browser/tags/trac-0.10.4/trac/web/main.py#L373, http://trac.edgewall.org/browser/tags/trac-0.10.4/trac/web/main.py#L377). When executed it failed to find directory named /home/trac/projects/http:
(line 377) where http:
part is taken from env_name
variable.
comment:5 by , 16 years ago
Milestone: | → 1.0 |
---|
comment:7 by , 14 years ago
Milestone: | triaging |
---|---|
Resolution: | → wontfix |
Status: | reopened → closed |
Obscure Trac/mod_python issue unlikely to be ever fixed, especially now that mod_python support itself is fading out.
(In the unlikely case someone is experiencing that issue in the future and want to revive this issue, try to explain it again the clearest way possible and provide a good patch).
comment:8 by , 8 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
Just FYI since some hours I've been experiencing same "Environment not found" error message even while simply trying to login as standard basic user (probably with simpler ticket creation rights only) into a Trac v1.0.2 based site. Because this ticket is the only one related to same exact error message, it would be very nice to see here also some more explanations about possible known causes of such error message when experienced under aforementioned conditions I described. Many Thanks in advance for your comprehension and help Best Regards
comment:9 by , 8 years ago
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
Please ask on the MailingList, and include information about your system configuration.
comment:10 by , 8 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
Hello Ryan,
many thanks for quick update. When you say 'information about your system configuration' do you simply mean A) only considering my client side or B) even much more details about web server side configuration with Trac 1.0.2 I'm connecting to as a client ? About B) please do note that because I'm not owning that web server I've no idea what its real system configuration might be (so I will only be able to provide its web address).
Best Regards
comment:11 by , 8 years ago
We'll need information about the web server, per my understanding of the problem you are reporting, but let's expand on that when you post to the mailing list.
comment:12 by , 3 years ago
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
Your Apache configuration file is invalid:
You have defined a handler for the root (
<Location "/">
). You cannot define another handler for any subtree (<Location "/en">
) as the first handler already serves "/en" requests.If you want to serve "/" and "/en", you probably want to use a rewrite rule to map "/" requests to another URI ("/default" for example)