Потеря знака вопроса в URL

Dmitriy Gorbenko dgorbenko at agenstvo.com
Wed Mar 18 16:05:42 MSK 2009


Добрый день, Игорь.

Вот лог работы nginx в режиме проксирования HTTP запроса к бекенду:

2009/03/18 14:49:22 [debug] 31023#0: *27 http process request 
line                                                          
2009/03/18 14:49:22 [debug] 31023#0: *27 http request line: "GET 
/@am/auto/@html/html/? HTTP/1.1"                           
2009/03/18 14:49:22 [debug] 31023#0: *27 http uri: 
"/@am/auto/@html/html/"                                                  
2009/03/18 14:49:22 [debug] 31023#0: *27 http args: 
""                                                                      
2009/03/18 14:49:22 [debug] 31023#0: *27 http exten: 
""                                                                     
2009/03/18 14:49:22 [debug] 31023#0: *27 http process request header 
line                                                   
2009/03/18 14:49:22 [debug] 31023#0: *27 http header: "Host: 
www.avtomagazine.ua"                                           
2009/03/18 14:49:22 [debug] 31023#0: *27 http header: "User-Agent: 
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.7) Gecko/2009030503 
Fedora/3.0.7-1.fc9 
Firefox/3.0.7"                                                                                 

2009/03/18 14:49:22 [debug] 31023#0: *27 http header: "Accept: 
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"                                                                                                                           

2009/03/18 14:49:22 [debug] 31023#0: *27 http header: "Accept-Language: 
en-us,en;q=0.5"                                     
2009/03/18 14:49:22 [debug] 31023#0: *27 http header: "Accept-Encoding: 
gzip,deflate"                                       
2009/03/18 14:49:22 [debug] 31023#0: *27 http header: "Accept-Charset: 
ISO-8859-1,utf-8;q=0.7,*;q=0.7"                      
2009/03/18 14:49:22 [debug] 31023#0: *27 http header: "Keep-Alive: 
300"                                                     
2009/03/18 14:49:22 [debug] 31023#0: *27 http header: "Connection: 
keep-alive"                                              
2009/03/18 14:49:22 [debug] 31023#0: *27 http header: "Cookie: b=b; 
iua=1; __utma=227210061.1667701433.1234260890.1237369382.1237378281.115; 
__utmz=227210061.1237281177.106.6.utmccn=(referral)|utmcsr=kh1.dev:8110|utmcct=/vw|utmcmd=referral; 
__utmc=227210061; b=b; iua=1; 
PHPSESSID=db260fba352779d1e9e893ef04b76b0b; 
__utmb=227210061"                                          
2009/03/18 14:49:22 [debug] 31023#0: *27 http header: "Pragma: 
no-cache"                                                    
2009/03/18 14:49:22 [debug] 31023#0: *27 http header: "Cache-Control: 
no-cache"                                             
2009/03/18 14:49:22 [debug] 31023#0: *27 http header 
done                                                                   
2009/03/18 14:49:22 [debug] 31023#0: *27 event timer del: 13: 
1237380627212                                                 
..........
2009/03/18 14:49:22 [debug] 31023#0: *27 http script copy: 
""                                                               
2009/03/18 14:49:22 [debug] 31023#0: *27 http proxy header: "User-Agent: 
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.7) Gecko/2009030503 
Fedora/3.0.7-1.fc9 
Firefox/3.0.7"                                                                           

2009/03/18 14:49:22 [debug] 31023#0: *27 http proxy header: "Accept: 
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"                                                                                                                     

2009/03/18 14:49:22 [debug] 31023#0: *27 http proxy header: 
"Accept-Language: en-us,en;q=0.5"                               
2009/03/18 14:49:22 [debug] 31023#0: *27 http proxy header: 
"Accept-Encoding: gzip,deflate"                                 
2009/03/18 14:49:22 [debug] 31023#0: *27 http proxy header: 
"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7"                
2009/03/18 14:49:22 [debug] 31023#0: *27 http proxy header: "Cookie: 
b=b; iua=1; 
__utma=227210061.1667701433.1234260890.1237369382.1237378281.115; 
__utmz=227210061.1237281177.106.6.utmccn=(referral)|utmcsr=kh1.dev:8110|utmcct=/vw|utmcmd=referral; 
__utmc=227210061; b=b; iua=1; 
PHPSESSID=db260fba352779d1e9e893ef04b76b0b; 
__utmb=227210061"                                    
2009/03/18 14:49:22 [debug] 31023#0: *27 http proxy header: "Pragma: 
no-cache"                                              
2009/03/18 14:49:22 [debug] 31023#0: *27 http proxy header: 
"Cache-Control: no-cache"                                       
2009/03/18 14:49:22 [debug] 31023#0: *27 http proxy 
header:                                                                 
"GET /@am/auto/@html/html/ 
HTTP/1.0                                                                                          

Host: 
beta3.dev:8091                                                                                                         

Connection: 
close                                                                                                            

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.7) 
Gecko/2009030503 Fedora/3.0.7-1.fc9 Firefox/3.0.7           
Accept: 
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8                                                      

Accept-Language: 
en-us,en;q=0.5                                                                                              

Accept-Encoding: 
gzip,deflate                                                                                                

Accept-Charset: 
ISO-8859-1,utf-8;q=0.7,*;q=0.7                                                                               

Cookie: b=b; iua=1; 
__utma=227210061.1667701433.1234260890.1237369382.1237378281.115; 
__utmz=227210061.1237281177.106.6.utmccn=(referral)|utmcsr=kh1.dev:8110|utmcct=/vw|utmcmd=referral; 
__utmc=227210061; b=b; iua=1; 
PHPSESSID=db260fba352779d1e9e893ef04b76b0b; 
__utmb=227210061                                                                                                   

Pragma: 
no-cache                                                                                                             

Cache-Control: 
no-cache                                                                                                      


"
..........
2009/03/18 14:49:22 [debug] 31023#0: *27 recv: fd:14 220 of 
4096                                          
2009/03/18 14:49:22 [debug] 31023#0: *27 http proxy status 302 "302 
Found"                                
2009/03/18 14:49:22 [debug] 31023#0: *27 http proxy header: "Connection: 
close"                           
2009/03/18 14:49:22 [debug] 31023#0: *27 http proxy header: "Server: 
Yaws/1.76 Yet Another Web Server"    
2009/03/18 14:49:22 [debug] 31023#0: *27 http proxy header: "Location: 
http://beta3.dev:8091/@am/auto/@html/html/?"
2009/03/18 14:49:22 [debug] 31023#0: *27 http proxy header: "Date: Wed, 
18 Mar 2009 12:49:22 GMT"                 
2009/03/18 14:49:22 [debug] 31023#0: *27 http proxy header: 
"Content-Length: 1"                                   
2009/03/18 14:49:22 [debug] 31023#0: *27 http proxy header: 
"Content-Type: text/html"                             
2009/03/18 14:49:22 [debug] 31023#0: *27 http proxy header 
done                                                   
2009/03/18 14:49:22 [debug] 31023#0: *27 rewritten location: 
"/@am/auto/@html/html/?"                             
2009/03/18 14:49:22 [debug] 31023#0: *27 HTTP/1.1 302 
Found                                                       
Server: 
nginx/0.6.35                                                                                               

Date: Wed, 18 Mar 2009 12:49:22 
GMT                                                                                

Content-Type: 
text/html                                                                                            

Location: 
http://www.avtomagazine.ua/@am/auto/@html/html/?                                                         

Connection: 
keep-alive                                                                                             

Keep-Alive: 
timeout=20                                                                                             

Content-Length: 
1                                                                                                  



2009/03/18 14:49:22 [debug] 31023#0: *27 write new buf t:1 f:0 
00000000006A6400, pos 00000000006A6400, size: 233 file: 0, size: 
0                                                                                                                         

..........

Как видите, в nginx пришел запрос с URL
/@am/auto/@html/html/?
nginx переслал бекенду уже другой запрос:
/@am/auto/@html/html/
бекенд подумал, и попросил прийти к нему по нужному ему URL адресу 
(сделал 302 редирект):
/@am/auto/@html/html/?

Браузер опять идет к nginx, nginx выбрасывает знак вопроса, и все 
повторяется заново.

Скажите, Игорь, можно ли настроить nginx таким образом, чтобы знак 
вопроса сохранялся в URL адресе при проксировании в бекендам ?
Версия nginx - 0.6.35

Спасибо.





More information about the nginx-ru mailing list