Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nginx 配置 WebSocket 代理 #11

Open
zhangwt-cn opened this issue Sep 5, 2023 · 0 comments
Open

Nginx 配置 WebSocket 代理 #11

zhangwt-cn opened this issue Sep 5, 2023 · 0 comments
Labels
Nginx web 服务器

Comments

@zhangwt-cn
Copy link
Owner

zhangwt-cn commented Sep 5, 2023

# 匹配路径
location /websocket {
    proxy_set_header  Host $host;
    proxy_set_header  X-Real-IP  $remote_addr;
    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header  X-Forwarded-Proto   $scheme;
    # 代理地址
    proxy_pass        http://127.0.0.1:8040/websocket;
    
    # 关键配置 start
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    # 关键配置 end
} 
@zhangwt-cn zhangwt-cn added the Nginx web 服务器 label Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Nginx web 服务器
Projects
None yet
Development

No branches or pull requests

1 participant