-
Notifications
You must be signed in to change notification settings - Fork 58
IHttpConnectionFeature is null for Windows 7 (IIS 8), but works on Windows 10. #51
Comments
Can you provide more details? Do you have a sample that we can run? Something on github would be best |
At least package versions and startup code please. |
https://github.com/theonlylawislove/temp-aspnet-IISIntegration-issues-51 When running through IIS, I get "No connection feature..." as the response to the request.
I also have ran through all the instructions for publishing aspnet 5 to IIS. I am using HTTP Platform Handler 1.2. |
|
@guardrex, as far as I can tell, that change was not made. Correct? I'm not sure what your trying to say. |
Kestrel didn't populate IHttpConnectionFeature in rc1, but UseIISPlatformHandler would read the x-forwarded-for header and populate it for you. There's a known issue with UseIISPlatformHandler in rc1 where it may fail if the x-forwarded-for address included a port (8ee803d). Have your application display the request headers received. #17 (comment) |
New output:
|
Any recommendations for a work around? Should I parse this header myself, and add my own |
@Tratcher is that fixed in RC2? or RC1-update1? @theonlylawislove you could copy the code from the new IISPlatformHandler middleware if you're on RC1. |
OR ... you could try this ...#17 (comment) which will probably get you hacked, broke, fired, and prosecuted! 😄 |
Here is a quick piece of middleware that fixed this issue, in case someone needs it fixed pronto. public class IISIntegrationHackMiddlerware
{
// https://github.com/aspnet/IISIntegration/issues/51
private readonly RequestDelegate _next;
public IISIntegrationHackMiddlerware(RequestDelegate next)
{
_next = next;
}
public async Task Invoke(HttpContext context)
{
if (context.Request.Headers.ContainsKey("X-Forwarded-For"))
{
var header = context.Request.Headers["X-Forwarded-For"];
if (header.Count > 0)
{
var forwardFor = header[0];
if (!string.IsNullOrEmpty(forwardFor))
{
if (forwardFor.Contains(":"))
{
forwardFor = forwardFor.Substring(0, forwardFor.LastIndexOf(":"));
context.Request.Headers["X-Forwarded-For"] = forwardFor;
}
}
}
}
await _next(context);
}
} Register it before you register |
@davidfowl @guardrex Yes, that logic was fixed and moved to OverrideHeadersMiddleware. |
Is this expected? Bug?
The text was updated successfully, but these errors were encountered: