Nginx备忘录 2021-09-21 笔记,技巧 暂无评论 1104 次阅读 带跨域和WebSocket的反向代理配置: ``` server { listen 5002; {外部访问的端口} server_name 172.16.0.3 {外部访问的域名或IP}; location / { proxy_pass http://172.17.0.2:5002 {服务端的真实地址}; add_header Access-Control-Allow-Origin * always; add_header Access-Control-Allow-headers * always; proxy_set_header Cookie $http_cookie; proxy_set_header Remote_Addr $remote_addr; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Origin ""; } } ``` 标签: none 本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。
评论已关闭