How to disable Keep-Alive in IIS conditionally?

My situation is this: I have an ASP.NET Core REST API using Kestrel reverse proxy through IIS (via AspNetCoreModule). On a special endpoint (hardware device required) I send the heading " Connection: close"- HTTP. I don’t send this header to all other endpoints. Therefore, when I run the REST API offline (without IIS), everything works as expected. But as soon as I run it over IIS, IIS does not redirect the Connection header. although all other headers are redirected correctly. Disabling keep-alive for all endpoints is not an option. So far I have tried to install a rewrite module for IIS and create an outbound rule with it corresponding to the connection header set to close, and reset it matches. It seems that IIS is ignoring the server variables RESPONSE_Connection and HTTP_CONNECTION (I tried other headers with the same rule and worked).

The best solution would be to not have a rewrite module installed. Thanks in advance for any solutions.

+6
source share

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


All Articles