如果要将wss转换为ws,需要在nginx配置文件中添加如下配置:

map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}

server {
    listen 443 ssl;
    server_name xx.gpde.com;

    ssl_certificate /path/to/ssl.crt;
    ssl_certificate_key /path/to/ssl.key;

    location /proxy/ {
        proxy_pass http://111.56.25.15:6099/oodex/xDeser3;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
    }
}

这个配置将会将wss://xx.gpde.com:6013/proxy/111.56.25.15:6099/oodex/xDeser3转换为ws://xx.gpde.com/proxy/111.56.25.15:6099/oodex/xDeser3。其中,$http_upgrade和$connection_upgrade变量被用于将HTTP连接升级为WebSocket连接。

nginx config wss转ws如 wssxxgpdecom6013proxy1115625156099oodexxDeser3proxy 后面为ws的实际链接

原文地址: http://www.cveoy.top/t/topic/brQl 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录