我有点困惑,并不明白为什么我得到404 Not found请求http:/customer.local/sign-out奇怪的是,这是只发生在Firefox浏览器与CURL或Chrome工作正常。 在这里我的nginxconfiguration。 预期的302端点/sign-out响应。 但是Firefox的回应是404。
upstream cd_tomcat { server 127.0.0.1:9180; } upstream ua_tomcat { server 127.0.0.1:9080; } server { listen 80; listen [::]:80; server_name customer.local; proxy_hide_header X-Frame-Options; proxy_hide_header X-XSS-Protection; proxy_hide_header Strict-Transport-Security; proxy_hide_header X-Content-Type-Options; proxy_hide_header X-Nexmo-Disable2FA; proxy_hide_header X-Nexmo-Trace-Id; add_header X-Frame-Options sameorigin always; add_header X-XSS-Protection "1; mode=block;" always; add_header Strict-Transport-Security "max-age=31536000; includeSubdomains" always; add_header X-Content-Type-Options nosniff always; proxy_connect_timeout 1s; proxy_read_timeout 120s; # reverse proxy headers proxy_set_header Host $host; proxy_set_header Connection ""; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Strict-Transport-Security max-age=15768000; location = /sign-out { proxy_pass http://ua_tomcat; } location / { limit_except HEAD GET POST DELETE PUT { deny all; } proxy_pass http://cd_tomcat; } }
Chrome响应:
Request URL:http://customer.local/sign-out Request Method:POST Status Code:302 Found Remote Address:127.0.0.1:80 Referrer Policy:no-referrer-when-downgrade Response Headers view source Cache-Control:no-cache, no-store, max-age=0, must-revalidate Connection:keep-alive Content-Language:en-US Content-Length:0 Date:Thu, 11 May 2017 00:29:07 GMT Expires:0 Location:http://customer.local/sign-in Pragma:no-cache Server:nginx/1.10.0 (Ubuntu) Request Headers Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Encoding:gzip, deflate Accept-Language:en-US,en;q=0.8 Cache-Control:max-age=0 Connection:keep-alive Content-Length:42 Content-Type:application/x-www-form-urlencoded Cookie:ajs_anonymous_id=%224271d2c1-8a46-496f-ace1-c8834409057e%22; km_ai=hx%2BHamG8gzdMvH4JRxc09nlXMnY%3D; _gat=1; _dc_gtm_UA-20475086-1=1; km_lv=x; SESSION=116bd916-a441-42a3-8cc0-5bf397324c33.dev1.peter; ajs_group_id=null; ajs_user_id=null; DWRSESSIONID=qHJkIWiZijOADHxDUbYZeP0NVBxinfhDQLl; kvcd=1494462543395; km_vs=1; __ar_v4=5J6GBCUY75GLBH2KZNAP4J%3A20170509%3A12%7C4INKOFBHJNDVXOG5I2YP4W%3A20170509%3A12%7CPJYNR5FAJJBTHGC5IKPIUR%3A20170509%3A12; _ga=GA1.2.900688302.1494457586; _gid=GA1.2.1957585239.1494462547; _gat_UA-20475086-1=1 Host:customer.local Origin:http://customer.local Referer:http://customer.local/ Upgrade-Insecure-Requests:1 User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
error.log是空的。 在访问日志中
127.0.0.1 - - [11/May/2017:00:26:31 +0100] "GET /sign-out HTTP/1.1" 404 0 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0" 127.0.0.1 - - [11/May/2017:00:26:33 +0100] "GET /sign-out HTTP/1.1" 404 0 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
我得到404 Not found的原因是上游无法desrialize会话信息。 所以实际上这个问题不是在nginxconfiguration中,而是在上游端。
还是不太明白为什么404而不是50X。