在confluence中出现Handshake failed due to invalid Upgrade header: null

在confluence中出现Handshake failed due to invalid Upgrade header: null

 

Last night, my colleague said that confluence could not save the log after writing, and then I logged in to confluence to write the log to save, but it really could not be saved. The error message is as follows:

Lost connection to server, please contact confluence administrator.

At that time, the investigation was carried out, and the log of confluence was found first.

#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

It can be seen that there is indeed an error in the confluence log. First, I saw http-nio-18090-exec-6. At that time, I thought of doing domain name resolution on Alibaba Cloud, and then doing nginx proxy forwarding on the local server. Check nginx configuration file:

#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;
               }
  }

Then I searched for the error information in the confluence log file on the Internet, and found that two lines of information need to be added to the nginx configuration file 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;
               }
  }

Go to confluence again for log submission, success, perfect solution!

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324817626&siteId=291194637