| Nginx-ru mailing list archive (nginx-ru@sysoev.ru) [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
 Re: Обработка error_page 405
 
 
23.07.2013 14:38, Maxim Dounin пишет:
 
Hello!
On Tue, Jul 23, 2013 at 12:00:14AM +0300, Андрей Василишин wrote:
 
Есть такая конструкция:
         error_page 405             /errors/405.html;
         location = / {
                 if ($request_method = POST) {
                 return 405;
                 }
        }
         location ^~ /errors/ {
                 root   /var/www;
         }
но при  POST /
отдается стандартная нгинксовкая 405 Not Allowed
 
Видимо, конструкция не совсем такая, и либо там, где
обрабатывается запрос, нет error_page 405, либо после
пренаправления снова делается return 405.
 
Есть конечно еще локейшн location / { }
без обработки POST, да и error_page 405             /errors/405.html; 
вынесено уровень server.
Ну и в логах видно что запрос обрабатывается таки там больше нигде в 
конфиге нет return 405;
Дебаг:
2013/07/22 23:35:11 [debug] 28849#0: *3880899164 generic phase: 0
2013/07/22 23:35:11 [debug] 28849#0: *3880899164 rewrite phase: 1
2013/07/22 23:35:11 [debug] 28849#0: *3880899164 http script var
2013/07/22 23:35:11 [debug] 28849#0: *3880899164 http script var: 
"http://site.com/pi.php"
2013/07/22 23:35:11 [debug] 28849#0: *3880899164 http script regex: 
"(xxxxx|yyyyy)"
2013/07/22 23:35:11 [notice] 28849#0: *3880899164 "(xxxxx|yyyyy)" does 
not match "http://site.com/test.php", client: 176.104.57.123, server: 
site.com, request: "POST / HTTP/1.1", host: 
"site.com", referrer: "http://site.com/test.php"
2013/07/22 23:35:11 [debug] 28849#0: *3880899164 http script if
2013/07/22 23:35:11 [debug] 28849#0: *3880899164 http script if: false
2013/07/22 23:35:11 [debug] 28849#0: *3880899164 test location: "/"
2013/07/22 23:35:11 [debug] 28849#0: *3880899164 using configuration "=/"
2013/07/22 23:35:11 [debug] 28849#0: *3880899164 http cl:2 max:2102394880
2013/07/22 23:35:11 [debug] 28849#0: *3880899164 rewrite phase: 3
2013/07/22 23:35:11 [debug] 28849#0: *3880899164 http script var
2013/07/22 23:35:11 [debug] 28849#0: *3880899164 http script var: "POST"
2013/07/22 23:35:11 [debug] 28849#0: *3880899164 http script value: "POST"
2013/07/22 23:35:11 [debug] 28849#0: *3880899164 http script equal
2013/07/22 23:35:11 [debug] 28849#0: *3880899164 http script if
2013/07/22 23:35:11 [debug] 28849#0: *3880899164 http finalize request: 
405, "/?" a:1, c:1
2013/07/22 23:35:11 [debug] 28849#0: *3880899164 http special response: 
405, "/?" 
2013/07/22 23:35:11 [debug] 28849#0: *3880899164 http set discard body
2013/07/22 23:35:11 [debug] 28849#0: *3880899164 HTTP/1.1 405 Not Allowed
Server: nginx/1.2.4
Date: Mon, 22 Jul 2013 20:35:11 GMT
Content-Type: text/html
Content-Length: 172
Connection: keep-alive
_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://mailman.nginx.org/mailman/listinfo/nginx-ru 
 |