I want to reverse proxy like this:
foo.bar.com:3000 -> localhost:4000 bar.foo.com:8080 -> localhost:4000
I think if this is possible, it might look something like this:
server {
listen 3000
server_name foo.bar.com
listen 8080
server_name bar.foo.com
proxy_pass localhost:4000
#A lot more configuration
}
I know I can just create two server
directives, each listens on a different port
with different server_name
but both proxy_pass
to localhost:4000.
The problem with this approach is that: redundancy of configuration for each server
directive. (The configuration is duplicated - one for each server
directive).