我遇到了一个奇怪的问题,www.vimooc.org,这是网站。
如果通过搜索引擎或 href 链接,它将是一个空白页,但如果在浏览器的地址栏中输入完整的 url,它将正常工作。
为什么???
更新:
我找到了问题,但仍然不知道如何解决。
这是 referer 的问题。
只要Referer: xxxx
标头中有一个,http 请求就不会得到响应。
不起作用的标头:
GET / HTTP/1.1
Host: www.vimooc.org
Connection: keep-alive
Cache-Control: max-age=0
DNT: 1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.17 Safari/537.36
Sec-Fetch-User: ?1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Sec-Fetch-Site: cross-site
Sec-Fetch-Mode: navigate
Referer: http://vfxware.com/
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cookie: showEdit=true; sessionid=xxxx; ONLINE_NUMBER=xxxx
正在工作的标头:
GET / HTTP/1.1
Host: www.vimooc.org
Connection: keep-alive
Cache-Control: max-age=0
DNT: 1
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.17 Safari/537.36
Sec-Fetch-User: ?1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Sec-Fetch-Site: none
Sec-Fetch-Mode: navigate
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cookie: showEdit=true; sessionid=xxxx; ONLINE_NUMBER=xxxx
这是我的 nginx 配置:
upstream inxedu_web {
session_sticky mode=insert option=indirect;
server 127.0.0.1:1011;
check interval=3000 rise=2 fall=2 timeout=1000 type=http;
check_http_send "HEAD / HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
}
server {
listen 443 ssl;
server_name www.vimooc.org ;
ssl_certificate /home/tom/yinkuSSLCert/www/full_chain.pem;
ssl_certificate_key /home/tom/yinkuSSLCert/www/private.key;
location /socket.io/{
proxy_pass http://socket_nodes;
}
location ~* \.(html|htm|shtml|zip|rar|doc|docx|xls|xlsx|ppt|ppts|gif|jpg|jpeg|png|bmp|swf|ico|js|css)$ {
root /data/htdocs/inxedu_web;
}
location / {
proxy_set_header Host $host;
proxy_set_header Referer $http_referer;
proxy_set_header X-Forwarded-For $remote_addr;
#proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
session_sticky_hide_cookie upstream=inxedu_web;
proxy_pass http://inxedu_web;
}
access_log off;
}
答案1
有两个选项:
您的服务器配置为在 HTTP
Referer
请求中存在标头。可能是过度尝试禁止资源热链接。当您的 Web 应用程序尝试解释
Referer
请求中的标头时,它崩溃了。