Heroku error 503, webSockets on multiple domains

这一生的挚爱 提交于 2020-01-24 17:38:04

问题


I'm experiencing a 503 error with heroku on my project using WebSockets and a custom domain.

  • Connecting on http://www.mydomain.com (That point with CNAME on my heroku app)

WebSocket connection to 'ws://www.mydomain.com/shoutbox' failed: Error during WebSocket handshake: Unexpected response code: 503

  • Connecting on http://myapp.herokuapp.com

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.


回答1:


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.



来源:https://stackoverflow.com/questions/23104517/heroku-error-503-websockets-on-multiple-domains

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!