0

Our FWLB is sending an X-Forwarded-Proto header, which is visible in the IIS logs:

#Fields: date time cs-method ... X-Forwarded-For X-Forwarded-Proto
2017-06-05 13:34:35 GET ... 1.2.3.4 http

But from C# it is not visible:

var output = $"X-Forwarded-Proto is {Request.Headers["X-Forwarded-Proto"]} headers are: {string.Join(", ", Request.Headers)}";

Output

X-Forwarded-Proto is  headers are: Connection=close&Host=1.1.1.1

Why is the header not found in C#?

Fenton
  • 241,084
  • 71
  • 387
  • 401
  • Does anything show with Request.SeverVariables? https://stackoverflow.com/questions/1907195/how-to-get-ip-address – GregHNZ Jun 06 '17 at 08:52
  • Does this question help: https://stackoverflow.com/q/23220603/5311735? – Evk Jun 06 '17 at 09:29
  • @GregHNZ thanks for the suggestion, `Request.ServerVariables["HTTP_X_FORWARDED_PROTO"]` is also empty. – Fenton Jun 06 '17 at 09:40
  • @Evk in my case, I can see that the header has been set by the FWLB as it is in the IIS log. It is just that the ASP.NET MVC application can't find it. – Fenton Jun 06 '17 at 09:40

0 Answers0