#8490 closed (fixed)
path_info equals script_name on lighttpd using fastcgi under a subdirectory when accessed without a trailing '/'
Reported by: | mtrichardson | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Keywords: | path_info, script_name, lighttpd, fastcgi | |
Cc: | richard.davies@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I have a Django app running under lighttpd and fastcgi in a subdirectory. When accessed without a trailing '/', eg, example.com/carfactory instead of example.com/carfactory/, script_name is the same as path_info resulting in an attempt to resolve 'carfactory/carfactory' instead of '/'.
Simple patch attached that fixes this.
Attachments (4)
Change History (16)
by , 16 years ago
comment:1 by , 16 years ago
This is only relevant for flup 1.0.1 - flup 1.0 appears to handle this properly.
comment:2 by , 16 years ago
milestone: | → 1.0 |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:4 by , 16 years ago
Cc: | added |
---|
follow-up: 6 comment:5 by , 15 years ago
milestone: | 1.0 → 1.2 |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
http://code.djangoproject.com/ticket/8874
nginx + django Still have this problem
comment:6 by , 15 years ago
milestone: | 1.2 → 1.0 |
---|---|
Resolution: | → fixed |
Status: | reopened → closed |
Replying to qingfeng:
http://code.djangoproject.com/ticket/8874
nginx + django Still have this problem
Why did you reopen this ticket if that other one (also open) already reports the issue? We only need one open ticket per problem. This one was fixed nearly a year ago. After that long, it is preferable to open a new ticket to track a new problem. Unless there is already an open ticket that covers the issue (#8874?), in which case it is not necessary to do anything unless you want to pitch in and help with fixing the open ticket.
comment:7 by , 15 years ago
This patch is not good.
the code is good:
if not path_info: path_info = u'/' if path_info == script_name: script_name = u''
by , 15 years ago
Attachment: | wsgi_r11339.diff added |
---|
follow-up: 9 comment:8 by , 15 years ago
milestone: | 1.0 → 1.2 |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
nginx+django project conf file:
http://code.djangoproject.com/attachment/ticket/8490/nginx.conf
http://code.djangoproject.com/attachment/ticket/8490/sina.conf
urls.py:
from django.conf.urls.defaults import * urlpatterns = patterns('', (r'^hello/', 'demo.views.hello'), )
demo/views.py
from django.http import HttpResponse def hello(request): return HttpResponse("Hello")
Django 1.1 Test:
curl -I http://localhost/hello
Restuls:
HTTP/1.1 404 NOT FOUND Server: nginx/0.7.62 Date: Wed, 16 Sep 2009 09:23:29 GMT Content-Type: text/html Connection: keep-alive
use new patch:
http://code.djangoproject.com/attachment/ticket/8490/wsgi_r11339.diff
curl -I http://localhost/hello
Results:
HTTP/1.1 200 OK Server: nginx/0.7.62 Date: Wed, 16 Sep 2009 10:27:11 GMT Content-Type: text/html; charset=utf-8 Connection: keep-alive Vary: Cookie
follow-up: 10 comment:9 by , 15 years ago
milestone: | 1.2 → 1.0 |
---|---|
Resolution: | → fixed |
Status: | reopened → closed |
Simple patch which tests to see if path_info equals script_name and, if so, set it to '/'