Opened 15 years ago
Last modified 15 years ago
#257 closed defect (FIXED)
request.path_info sometimes used incorrectly
| Reported by: | Elrond | Owned by: | Christopher Allan Webber |
|---|---|---|---|
| Priority: | minor | Milestone: | 0.1.0 |
| Component: | programming | Keywords: | |
| Cc: | Parent Tickets: |
Description
When running mediagoblin in a subpath, like /mediagoblin/, then some things are a little complex.
For /mediagoblin/u/elrond/ request.path_info becomes /u/elrond/.
- This is good, when trying to match routes. Simple, fine, job done.
- This is BAD, when generating URLs like "request.path_info + foo" for the browser, because the browser will only see /u/elrond/foo. Which is wrong. Problem.
I know, that the environ has SCRIPT_NAME ("/mediagoblin" in this case), but it's not entirely clear, on how to procede from here.
Assigning to Chris, as he created most of the base infrastructure and surely has comments.
Change History (8)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
One possible, simple way to help this issue:
request.long_path = environ["SCRIPT_NAME"] + request.path_info # or request.long_path = environ["SCRIPT_URL"]
And then request.long_path can be used in many places to mean the long, useful URL to reach the current page (without query params).
In reality, I think, no places (except routing) need request.path_info. So maybe it should be banned somehow?
comment:3 by , 15 years ago
Just to be sure, you changed how this was "mounted" via paste, is that correct? Or was it via fastcgi, or some other thing?
comment:4 by , 15 years ago
plain fastcgi: My main webserver serves my main site. And it redirects /mediagoblin/ via fcgi to GMG.
comment:5 by , 15 years ago
| Milestone: | → 0.2.0 |
|---|---|
| Owner: | changed from to |
I volunteered to take care of this. Especially, as I understand the problem quite well and have an idea on how to fix it.
comment:6 by , 15 years ago
| Owner: | changed from to |
|---|---|
| Status: | New → Feedback |
Branch: misc/i592_use_full_path
Comments welcome!

If mediagoblin wants to support subdir hosting for 0.1.0, then this bug should be targetted for 0.1.0.