I am running Meteor on AWS Elastic Beanstalk. Everything is up and running except that it's not running Websockets with the following error:
我在AWS Elastic Beanstalk上运行Meteor。一切都正常运行,除了它没有运行Websockets并出现以下错误:
WebSocket connection to 'ws://MYDOMAIN/sockjs/834/sxx0k7vn/websocket' failed: Error during WebSocket handshake: Unexpected response code: 400
My unstanding was to add something like:
我的不足之处是添加如下内容:
proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade";
proxy_set_header升级$ http_upgrade; proxy_set_header连接“升级”;
To the proxy config, via my YML config file.
到代理配置,通过我的YML配置文件。
Via my .exbextension config file:
通过我的.exbextension配置文件:
files:
"/etc/nginx/conf.d/proxy.conf" :
mode: "000755"
owner: root
group: root
content: |
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
I have ssh'd into the server and I can see the proxy.conf with those two lines in it.
我已经ssh进入服务器,我可以看到proxy.conf中包含这两行。
When I hit my webserver I still see the "Error during WebSocket handshake: " error.
当我点击我的网络服务器时,我仍然看到“WebSocket握手期间的错误:”错误。
I have my beanstalk load configured with stick sessions and the following ports:
我的beanstalk负载配置了stick会话和以下端口:
BTW I did see https://meteorhacks.com/load-balancing-your-meteor-app.html and I tried to:
顺便说一句,我确实看到了https://meteorhacks.com/load-balancing-your-meteor-app.html,我试图:
Enable HTTP load balancing with Sticky Session on Port 80 Enable TCP load balancing on Port 8080, which allows websocket
But could not seem to get that working either.
使用端口80上的粘滞会话启用HTTP负载平衡在端口8080上启用TCP负载平衡,这允许websocket但似乎无法使其正常工作。
Adding another shot at some YAML that does NOT work here": https://gist.github.com/adamgins/0c0258d6e1b8203fd051
在一些不起作用的YAML上添加另一个镜头“:https://gist.github.com/adamgins/0c0258d6e1b8203fd051
Any help appreciated?
任何帮助表示赞赏
2 个解决方案
#1
14
With a LOT of help from AWS paid support, I got this working. The reality is I was not far off it was down to some SED syntaxt.
在AWS付费支持的帮助下,我得到了这个工作。实际情况是我离一些SED合成器不远了。
Here's what currently works (Gist):
这是目前的工作(Gist):
option_settings:
- option_name: AWS_SECRET_KEY
value: <SOMESECRET>
- option_name: AWS_ACCESS_KEY_ID
value: <SOMEKEY>
- option_name: PORT
value: 8081
- option_name: ROOT_URL
value: <SOMEURL>
- option_name: MONGO_URL
value: <SOMEMONGOURL>
- option_name: MONGO_OPLOG_URL
value: <SOMEMONGOURL>
- namespace: aws:elasticbeanstalk:container:nodejs
option_name: ProxyServer
value: nginx
option_name: GzipCompression
value: true
- namespace: aws:elasticbeanstalk:container:nodejs:staticfiles
option_name: /public
value: /public
container_commands:
01_nginx_static:
command: |
sed -i '/\s*proxy_set_header\s*Connection/c \
proxy_set_header Upgrade $http_upgrade;\
proxy_set_header Connection "upgrade";\
' /tmp/deployment/config/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf
In addition to this you need to got into your Load balancer and change the Listener from HTTP to TCP:
除此之外,您需要进入负载均衡器并将侦听器从HTTP更改为TCP:
described here: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.managing.elb.html).
这里描述:http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.managing.elb.html)。
#2
0
Have you checked out Meteor WebSocket handshake error 400 with nginx? I think their configuration might be a bit different from yours. I'm in the same boat as you, trying to get this exact same set up working.
你有没有用nginx检查过Meteor WebSocket握手错误400?我认为他们的配置可能与您的配置略有不同。我和你在同一条船上,试图让这个完全相同的设置工作。
#1
14
With a LOT of help from AWS paid support, I got this working. The reality is I was not far off it was down to some SED syntaxt.
在AWS付费支持的帮助下,我得到了这个工作。实际情况是我离一些SED合成器不远了。
Here's what currently works (Gist):
这是目前的工作(Gist):
option_settings:
- option_name: AWS_SECRET_KEY
value: <SOMESECRET>
- option_name: AWS_ACCESS_KEY_ID
value: <SOMEKEY>
- option_name: PORT
value: 8081
- option_name: ROOT_URL
value: <SOMEURL>
- option_name: MONGO_URL
value: <SOMEMONGOURL>
- option_name: MONGO_OPLOG_URL
value: <SOMEMONGOURL>
- namespace: aws:elasticbeanstalk:container:nodejs
option_name: ProxyServer
value: nginx
option_name: GzipCompression
value: true
- namespace: aws:elasticbeanstalk:container:nodejs:staticfiles
option_name: /public
value: /public
container_commands:
01_nginx_static:
command: |
sed -i '/\s*proxy_set_header\s*Connection/c \
proxy_set_header Upgrade $http_upgrade;\
proxy_set_header Connection "upgrade";\
' /tmp/deployment/config/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf
In addition to this you need to got into your Load balancer and change the Listener from HTTP to TCP:
除此之外,您需要进入负载均衡器并将侦听器从HTTP更改为TCP:
described here: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.managing.elb.html).
这里描述:http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.managing.elb.html)。
#2
0
Have you checked out Meteor WebSocket handshake error 400 with nginx? I think their configuration might be a bit different from yours. I'm in the same boat as you, trying to get this exact same set up working.
你有没有用nginx检查过Meteor WebSocket握手错误400?我认为他们的配置可能与您的配置略有不同。我和你在同一条船上,试图让这个完全相同的设置工作。