H15 on Heroku SSE request

送分小仙女□ 提交于 2019-11-28 12:14:35

After trying everything, changing and re-writing my code, profiling the network etc., finally my friend (with no Node knowledge whatsoever) came up with an idea that put me on the right track:

It seems like this is a domain issue - NOT a code issue at all.
I set an ANAME mapping and it turns out that since Heroku uses 5 different IPs, mapping to just one of them can screw up an SSE call. Basically, mydomain.com showed an IP different than mydomain.herokuapp.com - meaning the server tried returning a response to a different IP than the one that initiated the call, hence it timed out.

I ditched the ANAME in favor of a CNAME (basically, giving up the naked mydomain.com in favor of www.mydomain.com) and now it seems to be working.

Conclusions:

  1. Not everything is a code issue - if it works well in one environment and not in another, it's a configuration issue
  2. If you struggle with something for too long, it helps to bring in a new set of eyes. Even with no subject matter expertise, you'll get great ideas to fresh approaches you can try
  3. 1and1 DNS control sucks b@lls. Moving out of there

I have run into the same problem with a Meteor application. All of a sudden every interaction returned a websocket error on the application and a h15 error on the heroku. I have resolved it by changing the root url to a naked domain, and then forwarding the naked domain to a www.example.com. Hope this would also help someone. I also totaly agree with @TravelingTechGuy on

Not everything is a code issue - if it works well in one environment and not in another, it's a configuration issue

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