diff --git a/samples/Mvc.Client/Startup.cs b/samples/Mvc.Client/Startup.cs index 1393c243..5e94e6eb 100644 --- a/samples/Mvc.Client/Startup.cs +++ b/samples/Mvc.Client/Startup.cs @@ -2,6 +2,7 @@ using Microsoft.AspNet.Authentication; using Microsoft.AspNet.Authentication.Cookies; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; +using Microsoft.AspNet.HttpOverrides; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.IdentityModel.Protocols.OpenIdConnect; @@ -26,6 +27,10 @@ namespace Mvc.Client { options.FlowWindowsAuthentication = false; }); + app.UseOverrideHeaders(new OverrideHeaderMiddlewareOptions { + ForwardedOptions = ForwardedHeaders.All + }); + app.UseStaticFiles(); // Insert a new cookies middleware in the pipeline to store the user diff --git a/samples/Mvc.Client/project.json b/samples/Mvc.Client/project.json index 63ab6574..cdf5a48c 100644 --- a/samples/Mvc.Client/project.json +++ b/samples/Mvc.Client/project.json @@ -6,8 +6,8 @@ "Microsoft.AspNet.Authentication.Cookies": "1.0.0-*", "Microsoft.AspNet.Authentication.OpenIdConnect": "1.0.0-*", "Microsoft.AspNet.IISPlatformHandler": "1.0.0-*", + "Microsoft.AspNet.HttpOverrides": "1.0.0-*", "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", - "Microsoft.AspNet.Server.WebListener": "1.0.0-*", "Microsoft.AspNet.StaticFiles": "1.0.0-*", "Microsoft.Extensions.Logging.Console": "1.0.0-*", diff --git a/samples/Mvc.Server/Startup.cs b/samples/Mvc.Server/Startup.cs index 5ebaae33..508c4644 100644 --- a/samples/Mvc.Server/Startup.cs +++ b/samples/Mvc.Server/Startup.cs @@ -1,6 +1,7 @@ using System.Linq; using CryptoHelper; using Microsoft.AspNet.Builder; +using Microsoft.AspNet.HttpOverrides; using Microsoft.AspNet.Identity.EntityFramework; using Microsoft.Data.Entity; using Microsoft.Extensions.Configuration; @@ -44,6 +45,10 @@ namespace Mvc.Server { options.FlowWindowsAuthentication = false; }); + app.UseOverrideHeaders(new OverrideHeaderMiddlewareOptions { + ForwardedOptions = ForwardedHeaders.All + }); + app.UseStaticFiles(); // Add a middleware used to validate access diff --git a/samples/Mvc.Server/project.json b/samples/Mvc.Server/project.json index 1992e0de..ab65b732 100644 --- a/samples/Mvc.Server/project.json +++ b/samples/Mvc.Server/project.json @@ -9,6 +9,7 @@ "Microsoft.AspNet.Authentication.Twitter": "1.0.0-*", "Microsoft.AspNet.Diagnostics": "1.0.0-*", "Microsoft.AspNet.IISPlatformHandler": "1.0.0-*", + "Microsoft.AspNet.HttpOverrides": "1.0.0-*", "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-*", "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", "Microsoft.AspNet.StaticFiles": "1.0.0-*",