Score:0

Forward DNS to specific ports to access docker container

cn flag

I have 1 domain and 1 subdomain:

example.com.au
api.example.com.au

I have 2 docker containers running 2 different applications, a frontend website and an API. These containers are accessible over 8080 (frontend) and 3000 (backend).

Both domains are on an ELB over HTTPS and I have setup IP routing to forward traffic from http and https to port 8080 so the frontend web app is loading fine but the webapp needs to access the API through a different domain (subdomain) however I am completely lost on how to get api.example.com.au to load data from the API on port 3000.

I thought perhaps an apache container accepting all traffic from example.com.au and api.example.com.au and then proxypass to the appropriate containers over the different ports but also unsure how to achieve this based on some examples I found...or even if this is the best approach.

djdomi avatar
za flag
i would just sit nginx on the host and use it to reverse proxy to both of them since its the same host it will be easy to setp these
Score:0
in flag

DNS only provides name to IP lookup, this has nothing to do with ports.

What you should probably be looking at is how vhosts work in a webserver, after that you can use reverse proxy functionality. or HTTP redirects to give url with different port (I do not recommend you doing this)

But the main take away here is again that DNS can never be used to control ports or parts of the url other then just which IP a given hostname should connect to.

puks1978 avatar
cn flag
Thanks for the response. I've setup apache and handled the routing through proxy to the port and all seems to be working fine.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.