I have multiple services running in a machine behind NGINX,
Using server_name configured for few application's end points
server {
server_name my_app_1;
listen *:443;
....
}
server {
server_name my_app_2;
listen *:443;
....
}
Since i want one service to be a default application for my machine, I exposed it as a default-server
#mydomain.com
server {
listen *:443 default_server;
location / {
...
}
}
The problem is, when the NGINX receives a request for https :// mydomain.com with HOST header set as 'another.app.com', the default_server starts serving.. It returns 404,
But I want to restrict the default-server or another server to serve only when HOST header and request domain are same.
something like,
server {
server_name $request_domain;
listen *:443;
}
Please help me on this.
Note: We can give the possible combination of all domain names for server_name. In my case IPs are not static / dynamic