Forum Discussion
X-Forwarded-For header is being removed somwhere between my IIS reverse-proxy and backend IIS setup
Hi,
I've the following web hosting setup:
1. Users facing Windows Server 2016 Server (v1607 - OS Build 1493.2791)
with IIS v10.0.14393.0 and Application request routing 3.0 acting as an IIS reverse-proxy for backoffice server.
2. Backoffice Windows Server 2019 Server (v1809 - OS Build 17763.1817)
with IIS v10.0.17763.1 hosting mix of Angular and .Net applications.
When ARR on the IIS reverse-proxy is configured to preserve client IP in X-Forwarded-For header, it is not added to the incoming requests on the backoffice server. But when I change the header name to something different (like X-Forwarded-For2 for an instance) it suddenly is added to the incoming requests and the backoffice server can see it. When I change the name back to the default value it disappears again from the incoming requests on the backoffice server. It seems like there is something that removes the header if its named X-Forwarded-For.
Unfortunately I can't use a different header name because of the third party software on the backoffice server is expecting the standard header name - X-Forwarded-For.
I have used Postman to simulate the request and manually added X-Forwarded-For and X-Forwarded-For2 headers with mocked IP addresses. I've sent the requests from Postman directly to the backoffice IIS server and X-Forwarded-For2 header value only is present in backoffice IIS server logs.The log column for X-Forwarded-For header value is dashed out.
Is there a configuration option controlling this unexpected behavior I can change to my advantage?
(Edit)
I've checked IIS reverse-proxy log also configured to log X-Forwarded-For values and it is filled with my IP address before reaching backoffice IIS server. So this is a solid proof that "something" is clearing X-Forwarded-For on the backoffice IIS server 😕
Mystery solved: the X-Forwarded-For header is "consumed" and removed from the requests by one of the .Net applications hosted on the backoffice IIS server...
2 Replies
- RobertN_42Copper Contributor
Mystery solved: the X-Forwarded-For header is "consumed" and removed from the requests by one of the .Net applications hosted on the backoffice IIS server...
- paulchanggCopper Contributor
RobertN_42 Hi Robert, I also have the same question. Could you please provide a detailed explanation of why it is being consumed?