0

I have multiple domains and subdomains, and I have a serivce on a port, that I'd like to setup so that it's accessible only on one certain subdomain. So for example foo.bar:9999 works, but bar:9999, baz:9999, and foo.baz:9999 doesn't.

How do I achieve it? I'm not able to find anything. I'm using nginx if there is a way to do it via it.

SoptikHa
  • 133
  • 7
  • What protocol are you using? Is it `http(s)`? Is Nginx listening on port 9999, or are you thinking of deploying it as a reverse proxy? Does [this help](https://superuser.com/questions/1311050/nginx-serves-site-even-if-server-name-does-not-match). – Richard Smith Apr 30 '20 at 14:41
  • Yes, it's https. Nginx itself isn't listening on 9999. I could use a reverse proxy and disallow the port 9999 at all on the firewall, but this doesn't work with one application - I cannot update it and it expects traffic to arrive at `/`, and as I'm running multiple instances at one subdomain, I setup the proxy such as `/app1` goes to 9999, `/app2` goes to 9998, and so on. I tried using `rewrite` but failed to get it to work, so I thought about the approach with ports. I want the applications to not be reachable over other domain than `foo.bar`. Not sure what the easiest way is. – SoptikHa Apr 30 '20 at 15:04

0 Answers0