Hi
I am running an OWIN server (.net framework) behind a proxy. The OWIN app has the following middleware:
public override Task Invoke(IOwinContext context)
{
var forwardedProto = context.Request.Headers.Get("X-Forwarded-Proto");
if (forwardedProto != null)
{
context.Request.Scheme = forwardedProto;
}
var forwardedHost = context.Request.Headers.Get("X-Forwarded-Host");
if (forwardedHost != null)
{
//context.Request.Headers.Set("Host", forwardedHost);
context.Request.Host = new HostString(forwardedHost);
}
return Next.Invoke(context);
}
x-forwarded-* headers are set and this code executes. context.Request.Scheme is updated as expected. Setting context.Request.Host adds the Host header but context.Request.Host returns the unaltered host value (which would be localhost:xxxx.) I tried setting the Host header directly (commented out here) and it has the same effect. I've looked at the implementation of OwinRequest and it looks like it should just work.
Hi
I am running an OWIN server (.net framework) behind a proxy. The OWIN app has the following middleware:
x-forwarded-*headers are set and this code executes.context.Request.Schemeis updated as expected. Settingcontext.Request.Hostadds theHostheader butcontext.Request.Hostreturns the unaltered host value (which would belocalhost:xxxx.) I tried setting theHostheader directly (commented out here) and it has the same effect. I've looked at the implementation ofOwinRequestand it looks like it should just work.