在confluence中出现Handshake failed due to invalid Upgrade header: null
在confluence中出现Handshake failed due to invalid Upgrade header: null
昨天晚上同事说confluence写完日志保存不了,然后我登陆confluence写日志进行保存,竟然真的保存不了,报错信息如下:
与服务器失去连接,请联系confluence管理员。
当时就进行排查,首先找到confluence的日志
#cd /opt/atlassian/confluence/logs #tail -f -n 100 catalina.out ...................... 24-Apr-2018 20:56:32.242 ҏט [http-nio-18090-exec-7] org.springframework.web.socket.server.support.DefaultHandshakeHandler.handleInvalidUpgradeHeader Handshake failed due to invalid Upgrade header: null 24-Apr-2018 20:56:47.580 ҏט [http-nio-18090-exec-9] org.springframework.web.socket.server.support.DefaultHandshakeHandler.handleInvalidUpgradeHeader Handshake failed due to invalid Upgrade header: null 24-Apr-2018 20:58:38.132 ҏט [http-nio-18090-exec-5] org.springframework.web.socket.server.support.DefaultHandshakeHandler.handleInvalidUpgradeHeader Handshake failed due to invalid Upgrade header: null 24-Apr-2018 20:58:59.103 ҏט [http-nio-18090-exec-7] org.springframework.web.socket.server.support.DefaultHandshakeHandler.handleInvalidUpgradeHeader Handshake failed due to invalid Upgrade header: null 24-Apr-2018 21:00:09.113 ҏט [http-nio-18090-exec-4] org.springframework.web.socket.server.support.DefaultHandshakeHandler.handleInvalidUpgradeHeader Handshake failed due to invalid Upgrade header: null 24-Apr-2018 21:00:27.122 ҏט [http-nio-18090-exec-7] org.springframework.web.socket.server.support.DefaultHandshakeHandler.handleInvalidUpgradeHeader Handshake failed due to invalid Upgrade header: null 24-Apr-2018 21:00:47.117 ҏט [http-nio-18090-exec-5] org.springframework.web.socket.server.support.DefaultHandshakeHandler.handleInvalidUpgradeHeader Handshake failed due to invalid Upgrade header: null 24-Apr-2018 21:02:02.103 ҏט [http-nio-18090-exec-2] org.springframework.web.socket.server.support.DefaultHandshakeHandler.handleInvalidUpgradeHeader Handshake failed due to invalid Upgrade header: null 24-Apr-2018 21:02:17.137 ҏט [http-nio-18090-exec-6] org.springframework.web.socket.server.support.DefaultHandshakeHandler.handleInvalidUpgradeHeader Handshake failed due to invalid Upgrade header: null 24-Apr-2018 21:02:32.096 ҏט [http-nio-18090-exec-4] org.springframework.web.socket.server.support.DefaultHandshakeHandler.handleInvalidUpgradeHeader Handshake failed due to invalid Upgrade header: null 24-Apr-2018 21:02:48.099 ҏט [http-nio-18090-exec-6] org.springframework.web.socket.server.support.DefaultHandshakeHandler.handleInvalidUpgradeHeader Handshake failed due to invalid Upgrade header: null
可以看到确实是confluence日志里有报错,首先看到http-nio-18090-exec-6,当时就想到我在阿里云上面做了域名解析,然后在本地服务器上做了nginx的代理转发,查看nginx的配置文件:
#cd /application/nginx/conf #vim nginx.conf worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; listen 80; server_name wiki.gong-hui.com; location / { proxy_redirect off; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://192.168.3.175:18090; } }
接着在网上搜索confluence日志文件中的报错信息,发现需要在nginx配置文件location中加入两行信息:
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection
"upgrade"
;
worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; listen 80; server_name wiki.gong-hui.com; location / { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_redirect off; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://192.168.3.175:18090; } }
再次到confluence中进行日志提交,成功,完美解决!
-----------------------------------------要克服生活的焦虑和沮丧,得先学会做自己的主人-----------------------------------------