0

I have the following server block defined:

server {
  server_name jsonip.com www.jsonip.com ipv4.jsonip.com ipv6.jsonip.com;
  add_header x-domain-name "$server_name $http_host $host" always;
}

I'm setting the 'x-domain-name' header simply as a way to test what nginx is seeing and reflecting it back to the browser.

The issue I'm having is that if I access https://ipv4.jsonip.com, then $server_name is matching 'jsonip.com' rather than 'ipv4.jsonip.com'.

Conversely, both $http_host and $host are matching the domains correctly.

Is there a different way to configure the server_name domains in the server block to get $server_name to match correctly?

Geuis
  • 637
  • 3
  • 8
  • 20

0 Answers0