php – Nginx sets HTTP_HOST to punycode – Server Fault

I have a unicode domain name. It is configured as punycode in the server_name directive.

When I call $_SERVER['HTTP_HOST'] in my PHP code, I get that same punycode version. How do I configure Nginx to set HTTP_HOST to the unicode value instead?

As a hotfix, I call idn_to_utf8($_SERVER['HTTP_HOST'], 0, INTL_IDNA_VARIANT_UTS46) at the top of my script. But I would like this to be done automatically outside of my website code.

Closest I found is IDN and HTTP_HOST but it’s 10 years old and for Apache.

Read more here: Source link