【发布时间】:2016-11-16 10:45:30
【问题描述】:
我尝试在 Docker 容器内的服务器上运行基于 JHipster 的小型应用程序时遇到问题。
问题出在 Websocket 连接上:
VM1772:35 WebSocket connection to 'ws://example.com/websocket/tracker/011/oxjwhn1s/websocket?access_token=ey…_TUTlIQeihPamU9Cr4AELuIqgnxZlAExhpBzRGwTtSBsQtC1_uMmwttUYgMmvhdbZhMLCS2RoA' failed: Error during WebSocket handshake: Unexpected response code: 400
(我更改了实际域名)
应用在使用 maven 目标 docker:build 构建的 Docker 容器中运行。
为了只能通过域名访问,我使用了也在 Docker 容器 (https://github.com/jwilder/nginx-proxy) 内运行的 nginx 反向代理,我认为在 nginx 配置中可以设置标头转发:
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
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 $proxy_x_forwarded_proto;
为了让它正常工作,我缺少什么?
【问题讨论】:
标签: spring-boot jhipster spring-websocket