Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass all properties from original to target HttpContext on Copy #1486

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/Ocelot/Multiplexer/MultiplexingMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public async Task Invoke(HttpContext httpContext)
}
}

private HttpContext Copy(HttpContext source)
private static HttpContext Copy(HttpContext source)
{
var target = new DefaultHttpContext();

Expand All @@ -182,7 +182,21 @@ private HttpContext Copy(HttpContext source)
target.Request.Scheme = source.Request.Scheme;
target.Request.IsHttps = source.Request.IsHttps;
target.Request.RouteValues = source.Request.RouteValues;
target.Request.Cookies = source.Request.Cookies;
target.Request.Form = source.Request.Form;

target.Connection.ClientCertificate = source.Connection.ClientCertificate;
target.Connection.LocalIpAddress = source.Connection.LocalIpAddress;
target.Connection.LocalPort = source.Connection.LocalPort;
target.Connection.RemoteIpAddress = source.Connection.RemoteIpAddress;
target.Connection.RemotePort = source.Connection.RemotePort;

target.Items = source.Items;

target.RequestAborted = source.RequestAborted;
target.TraceIdentifier = source.TraceIdentifier;
target.User = source.User;

target.RequestServices = source.RequestServices;
return target;
}
Expand Down