Fwd: a problem when PATH_INFO == SCRIPT_NAME

22 views
Skip to first unread message

heng zhao

unread,
May 28, 2012, 8:12:15 PM5/28/12
to django-d...@googlegroups.com
---------- Forwarded message ----------
From: heng zhao <linux...@gmail.com>
Date: Mon, May 28, 2012 at 3:09 PM
Subject: Re: a problem when PATH_INFO == SCRIPT_NAME
To: django...@googlegroups.com


I read the comment in  https://code.djangoproject.com/ticket/8490,  I
found someone met the same problem 3years ago. why don't merge it into
chunk?

On Mon, May 28, 2012 at 2:56 PM, heng zhao <linux...@gmail.com> wrote:
> I'm using Django-1.4 and nginx with fastcgi mode.
> when I use runserver  mode everything goes well,  But in nginx &
> fastcgi ,whatever URL i visit, I get a response "/"
> I trace the code and found that , when PATH_INFO == SCRIPT_NAME,
> path_info has been set to  u'/' (core/handlers/wsgi.py WSGIRequest
> __init__)
> so all the request redirect to /
> for example , I visit /foo/, nginx send a fastcgi request with
> PATH_INFO = ‘/foo/’ & SCRIPT_NAME = '/foo/' ,and Django redirect it
> to ‘/’
> I change :
>
>    if not path_info or path_info == script_name :
>            path_info = u'/'
> to:
>
>   if not path_info :
>            path_info = u'/'
>   if path_info == script_name:
>            script_name = u''
>
> I found this problem has been reported and fixed in
> https://code.djangoproject.com/ticket/8490,
> but he treat it in a strange way,  i'm still wondering it's a django bug or not.
>
> excuse for my pool english :)
Reply all
Reply to author
Forward
0 new messages