Search code examples
httphttp-redirectidn

How should internationalised domain names (IDNA) be sent in the Location header on redirect?


Websites that have internationalized domain names will often want to respond to HTTP requests with a redirect status code (3XX). When they do that they will want to put the redirection target in the Location header.

If the website wants to use an absolute URI in the Location header, how should they provide their domain name? Specifically, should it be IDNA-encoded, or not?

(I'm presuming that if it's not IDNA-encoded it should be encoded using RFC 2047, but if this is wrong please let me know.)


Solution

  • It must be a valid HTTP URI (as per RFCs 3986 and 7230), thus non-ASCII characters in the host name will need to be IDNA-encoded. And no, RFC 2047 isn't applicable here.