问题描述
- 通过(与我的heroku应用上的CNAME有关的那一点)
- 通过
- Connecting on http://www.mydomain.com (That point with CNAME on my heroku app)
- Connecting on http://myapp.herokuapp.com
ul>
与'ws://www.mydomain.com/shoutbox'的WebSocket连接失败:WebSocket握手期间出错:意外的响应代码:503
一切顺利,地址 ws:// myapp.herokuapp.com/shoutbox
。在我的本地设置中,一切都很好。
是否有任何我不知道的跨域问题?我使用play!2作为服务器端fwk,但我认为这与这个问题没有任何关系。
如果我只能在我自己的域内连接,那就没问题了。因为这是我希望人们使用的地址。
我假设您已经启用 heroku labs:启用websockets
,因为您的 herokuapp
域名可以正常工作。
我有一个预感你的DNS查询正在击中一个不支持websocket的Heroku端点,也就是说,它在启用websockets功能之前缓存。
如果只有这种行为发生在单个客户端上,尝试刷新您的DNS缓存并再次尝试。或者,确保您的两个域的DNS记录都解析为相同的IP。
I'm experiencing a 503 error with heroku on my project using WebSockets and a custom domain.
WebSocket connection to 'ws://www.mydomain.com/shoutbox' failed: Error during WebSocket handshake: Unexpected response code: 503
Everything goes allright with adress ws://myapp.herokuapp.com/shoutbox
. Everything is also good in my local setup.
Is there any cross-domain issue I'm not aware off ? I'm using play!2 as server side fwk, but I don't think there is any relation to this problem.
[EDIT]If I can only connect within my own domain then it would be fine. Cause this would be the address I'd like people to use.
I'm assuming you already enabled heroku labs:enable websockets
since your herokuapp
domain is working properly.
I have a hunch your DNS query is hitting a Heroku endpoint that doesn't support websockets, i.e. it's cached from before you enabled the websockets functionality.
If this behavior only happens on a single client, try flushing your DNS cache and trying again. Alternatively, make sure the DNS records for both of your domains are resolving to the same IP.
这篇关于Heroku错误503,多个域上的webSockets的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!