$fastcgi_script_name and $document_uri chenged after 0.5.34 ?

梁冰鸿 Binghong.Liang at ReKoo.com
Tue Jul 8 15:04:19 MSD 2008


I have used nginx 0.5.34 for some days. The backend server is Django (run as
fastcgi).
 
I want to upgrade nginx to newer version now, but I find that all the
versions after 0.5.34 seem to change something with $fastcgi_script_name and
$document_uri.
 
This is some lines in my nginx.conf
 
location / {
  ...
  fastcgi_pass   127.0.0.1:10001;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  fastcgi_param SCRIPT_NAME $fastcgi_script_name;
  fastcgi_param REQUEST_URI $request_uri;
  fastcgi_param DOCUMENT_URI $document_uri;
  fastcgi_param DOCUMENT_ROOT $document_root;
  ...
}
 
And the Django fastcgi process listen on 127.0.0.1:10001.
  
A url in my app is
http://www.xxxxx.com/edit/10000/http://www.xxxxx.com/some.do 
  
The Django's urls.py map the url like this
  
(r'^edit/(?P<topicid>\d+?)/(?P<url>.+?)$', 'myapp.views.edit'),
 
So, when the usr click this url, the python program will get two parameters:
topicid=10000, url=http://www.xxxxx.com/some.do
 
It was ok when I use nginx 0.5.34. But When I use a newer version, the param
url changed to http:/www.xxxxx.com/some.do
 
I print SCRIPT_NAME and DOCUMENT_URI the Django, with 0.5.34 the result is 
 
SCRIPT_NAME = /edit/10000/http://www.xxxxx.com/some.do
DOCUMENT_URI = =/edit/10000/http://www.xxxxx.com/some.do
 
with new version the result is 
 
SCRIPT_NAME = /edit/10000/http:/www.xxxxx.com/some.do
DOCUMENT_URI = =/edit/10000/http:/www.xxxxx.com/some.do
 
It seems the new version had remove a '/' when the url contains '//'.
 
Is it a bug or just a change?
 
 
 
 
 

 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20080708/ac378de2/attachment.html>


More information about the nginx mailing list