WeChat Mini Programs visits the websocket server and returns 301. Would you please help me to see what the problem is?

nginx configuration

server {
    listen 443 ssl;
    ssl_certificate /etc/letsencrypt/live/**/**.pem;
    ssl_certificate_key /etc/letsencrypt/live/**/**.key;
    ssl_session_timeout 1d;
    ssl_session_cache shared:SSL:50m;
    ssl_dhparam /opt/dhparam/keys/dhparams.pem;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers "***";
    ssl_prefer_server_ciphers on;
    server_name xcx.test.com;
    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;
        proxy_pass http://127.0.0.1:9023;
        proxy_redirect off;
    }
    location /websocket/ {
        proxy_pass http://127.0.0.1:9092;
        -sharp WebScoket Support
        -sharp proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        -sharp proxy_set_header Origin xxx;
        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;
    }
}

uses the wss protocol.


Wechat stipulates that https must be used for interface requests. If you can debug locally, you can click on the upper right corner and then come out with several options, and check it out without checking the requested domain name

.
Menu