Location header with IDN characters damaged when placed in IIS

For some POST calls in our API, we indicate the response location header for the created resource.

The location header may contain URLs with IDN characters (e.g. http://résponse.com )

When hosting an API in IIS, IIS changes the location header to http://résponse.com/

There is definitely something wrong with the encoding. When we make the API itself, the Location header is not affected. Is there some kind of tweak that I am missing in IIS that causes this behavior? Content type encoding is configured to utf-8, but this is already the default value in IIS, I think.

IIS version is 8.5+. We use the Web API, but using NancyFx leads to the same behavior.

+6
source share
3 answers

I just enchanted special characters right now, but I still don’t understand why IIS changes the header, and the standalone solution does not support

0
source

You can try adding a header to the list of HTTP response headers for this site. If none is specified, it will be delivered in all user agent requests, which probably means that you see ISO-8859-1

"Properties" => "HTTP headers" => "File types ..." => "New type ...". Place the extension you want to display separately for each extension; IIS users will probably want to match .htm, .html, ... Then for the Content type, add "text / html; charset = utf-8" (without quotes; replace the required encoding for utf-8;

0
source

Set the coding and culture configuration in the .Net globalization function in IIS (suppose you use asp.net-based API?)

0
source

Source: https://habr.com/ru/post/987749/


All Articles