Closed Tratcher closed 7 years ago
Can you share all of the headers in your scenario? There are known cases where ForwardedHeaders fails to process some kinds of input.
So sorry. Moved on and took those environments down (damn cost savings!). I'm using the x-forwarded-for header right away cause I needed to solve a production scenario. On Wed, Aug 2, 2017 at 3:17 PM Chris Ross notifications@github.com wrote:
Can you share all of the headers in your scenario? There are known cases where ForwardedHeaders fails to process some kinds of input.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aspnet/BasicMiddleware/issues/256#issuecomment-319755110, or mute the thread https://github.com/notifications/unsubscribe-auth/AAkinZepca5OZ0_5HYeuxfqcqB2x0Dkyks5sUL1CgaJpZM4OnbmA .
Not enough information on this bug so closing it. If anyone has similar issues, please file another one with details.
Hi there .. I have same issue when the app running on docker container ..
but if its not in container, its working
Comments on closed issues are not tracked, please open a new issue with the details for your scenario.
The results in your last screen shot look correct, what problem are you having specifically?
From @luisgizirian on July 29, 2017 17:2
Why is that
Context.Connection.RemoteIpAddress
supplies the Proxy's address in scenarios whereForwardedHeadersOptions
were applied (either automatically by UseIISIntegration or manually), butContext.Request.Headers["X-Forwarded-For"][0]
gives me the right address?If I don't know beforehand the
ForwardedHeadersOptions.KnownProxies
, Is it possible to use the first X-Forwarded-For address to pre-fillContext.Connection.RemoteIpAddress
? (ForwardedHeadersOptions.ForwardLimit = 1
its default. AndRequireHeaderSymmetry = false
) so I always get the Client/Browser IP address no matter what?Tested scenarios (all based on ASPNET Core 2 preview 2):
An app comparing and writing back both values, following this document (https://docs.microsoft.com/en-us/aspnet/core/publishing/linuxproduction) is all you need.
Quick short-circuit:
Configure
in Startup.cs:Please advice.
(my apologies if this is not the right place to post this question)
Copied from original issue: aspnet/KestrelHttpServer#1974