Handshake failed due to invalid Upgrade header: null 解決方案

解決方案,在  Nginx  ,location 中添加如下紅色代碼:java

proxy_set_header Upgrade $http_upgrade;spa

proxy_set_header Connection   "upgrade" ;
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
server {
         listen  80 ;
         server_name localhost;
 
 
         location / {
                 proxy_set_header X-Real-IP $remote_addr;
                 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                 proxy_set_header Host $http_host;
                 proxy_set_header X-NginX-Proxy  true ;
 
                 # prevents  502  bad gateway error
                 proxy_buffers  8  32k;
                 proxy_buffer_size 64k;
 
                 proxy_pass http: //127.0.0.1:8080;
                 proxy_redirect off;
 
                 # enables WS support
                 proxy_http_version  1.1 ;
                 proxy_set_header Upgrade $http_upgrade;
                 proxy_set_header Connection   "upgrade" ;
         }
}
相關文章
相關標籤/搜索