Opened 7 years ago

Closed 6 years ago

Last modified 2 years ago

#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: master
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: UI/UX:

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)

8490.diff (1.1 KB) - added by mtrichardson 7 years ago.
Simple patch which tests to see if path_info equals script_name and, if so, set it to '/'
nginx.conf (1.1 KB) - added by qingfeng 6 years ago.
nginx.conf
sina.conf (628 bytes) - added by qingfeng 6 years ago.
Django project conf file
wsgi_r11339.diff (1.1 KB) - added by qingfeng 6 years ago.

Download all attachments as: .zip

Change History (16)

Changed 7 years ago by mtrichardson

Simple patch which tests to see if path_info equals script_name and, if so, set it to '/'

comment:1 Changed 7 years ago by mtrichardson

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

This is only relevant for flup 1.0.1 - flup 1.0 appears to handle this properly.

comment:2 Changed 7 years ago by mtredinnick

  • milestone set to 1.0
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 7 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [8569].

comment:4 Changed 7 years ago by Richard Davies <richard.davies@…>

  • Cc richard.davies@… added

comment:5 follow-up: Changed 6 years ago by qingfeng

  • milestone changed from 1.0 to 1.2
  • Resolution fixed deleted
  • Status changed from closed to reopened

http://code.djangoproject.com/ticket/8874

nginx + django Still have this problem

comment:6 in reply to: ↑ 5 Changed 6 years ago by kmtracey

  • milestone changed from 1.2 to 1.0
  • Resolution set to fixed
  • Status changed from reopened to 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 Changed 6 years ago by qingfeng

This patch is not good.

the code is good:

if not path_info:
    path_info = u'/'
if path_info == script_name:
    script_name = u''

Changed 6 years ago by qingfeng

nginx.conf

Changed 6 years ago by qingfeng

Django project conf file

Changed 6 years ago by qingfeng

comment:8 follow-up: Changed 6 years ago by qingfeng

  • milestone changed from 1.0 to 1.2
  • Resolution fixed deleted
  • Status changed from closed to 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

comment:9 in reply to: ↑ 8 ; follow-up: Changed 6 years ago by kmtracey

  • milestone changed from 1.2 to 1.0
  • Resolution set to fixed
  • Status changed from reopened to closed

Please stop reopening this ticket to report problems with nginx. This ticket reported a problem that was fixed before 1.0. That fix may have caused a different problem, reported in #8874. #8874 is the correct place to track fixing the follow-on problem, not here.

comment:10 in reply to: ↑ 9 Changed 6 years ago by qingfeng

Replying to kmtracey:

Please stop reopening this ticket to report problems with nginx. This ticket reported a problem that was fixed before 1.0. That fix may have caused a different problem, reported in #8874. #8874 is the correct place to track fixing the follow-on problem, not here.

sorry,i see.

comment:11 Changed 4 years ago by jacob

  • milestone 1.0 deleted

Milestone 1.0 deleted

comment:12 Changed 2 years ago by Aymeric Augustin <aymeric.augustin@…>

In f5dbb566ee07bf3328015c70574b832052b4ebb7:

Fixed #17550 -- Removed a workaround for a bug in flup 1.0.1.

This reverts commit 948a833eb7fd9be0bc2d585c92a407f036ef42b2.

flup appears to be dead, and this fix breaks legitimate uses of Django.

Refs #8490.

Note: See TracTickets for help on using tickets.
Back to Top