Umm I'll try to be more clear..
In an application server I have written in node.js, I have inner-proxy for multiple ports:
- in my
8080
port I have my rest api.
- in my
3000
port I have my push server and chat.
I use the npm package subdomain-router for inner-routing to the port, exposing sub-domains in the 'front-end' which proxy back to those ports.
code demonstration: (<some-app>
is not the real name of the app obviously)
require('subdomain-router')
({
host: '<some-app>.herokuapp.com',
subdomains:
{
'': 8080, // <some-app>.herokuapp.com <=> ::8080 --WORKS--
'api': 8080, // api.<some-app>.herokuapp.com <=> ::8080
'chat': 3000, // chat.<some-app>.herokuapp.com <=> ::3000
'push': 3000 // push.<some-app>.herokuapp.com <=> ::3000
}
}).listen(process.env.PORT || 5000);
The API works great, though I cannot access it through <some-app>.herokuapp.com:8080
, but only through <some-app>.herokuapp.com
and let the inner subdomain-router
module do it's magic.
Also, I can't access the subdomains. When trying to access api.<some-app>.herokuapp.com
I get No such app
error page from heroku.
TL;DR accessing <some-app>.herokuapp.com
works (redirects to /v1
path for my API), but unable to access <some-app>.herokuapp.com:8080
, <some-app>.herokuapp.com:3000
or chat.<some-app>.herokuapp.com
.
When trying to access my API by specifying the port in the url (like this: <some-app>.herokuapp.com:8080
), I get the following error in my browser (google chrome): ERR_CONNECTION_REFUSED
.
My educated guess says that it might be something related to opening ports in heroku, but I have no clue on how to do it (tried googling ofc).
It doesn't explain why I cannot access the sub-domains though.
Would appreciate any light shed on this issue.
I'm new to heroku and it's getting really frustrating.
Thanks!
Amit
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…