浏览 5.6k
1、操作系统版本:CentOS Linux release 7.6.1810 (Core)
2、软件版本:nginx-1.18.0稳定版本
3、部署架构:nginx(反向代理)+后端(windows系统+tomcat)
4、问题描述:通过域名访问后端tomcat部署的网站时,同一个目录下面的部分.js文件加载不了




5、目前已经做了如下相关排错措施:
a、关闭nginx系统防火墙、关闭后端系统防火墙
b、nginx到后端tomcat网站端口没有问题
c、如果把无法加载成功的js文件用代码美化工具美化后,就可以加载。
6、请问还有其他故障诊断方法吗?或者诊断措施?

按点赞数排序
按时间排序
如果是三次握手没有成功,需要在nginx及上游,分别用tcpdump/wireshark抓包看下,是SYN还是ACK报文丢失了,是在哪个节点丢失的,再来分析为何会丢失,又该如何恢复。
wireshark抓包参见我讲的这一课:https://time.geekbang.org/course/detail/100026801-100973
tcpdump抓包参见这里:https://time.geekbang.org/course/detail/100026801-118169
2
回答于2020-06-17 10:37
直接在Access-Control-Allow-Headers后参照以下代码中加粗字体格式,添加自定义需要支持的header,以逗号隔开即可。
add_header Access-Control-Allow-Headers 'Accept, Authorization,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
第1种。参考官方文档:
“When buffering is enabled, nginx receives a response from the proxied server as soon as possible, saving it into the buffers set by the proxy_buffer_size and proxy_buffers directives. If the whole response does not fit into memory, a part of it can be saved to a temporary file on the disk. Writing to temporary files is controlled by the proxy_max_temp_file_size and proxy_temp_file_write_size directives.
When buffering is disabled, the response is passed to a client synchronously, immediately as it is received. nginx will not try to read the whole response from the proxied server. The maximum size of the data that nginx can receive from the server at a time is set by the proxy_buffer_size directive.”
可以试着打开debug日志,然后看日志中记录哪里处理时间较长
配置方法:error_log /tmp/debug.log debug;
微信公众号
加入微信群