Skip to content

Instantly share code, notes, and snippets.

@changhuixu
Last active June 26, 2020 18:53
Show Gist options
  • Save changhuixu/ab553077a43d23497eaf50e68c39d561 to your computer and use it in GitHub Desktop.
Save changhuixu/ab553077a43d23497eaf50e68c39d561 to your computer and use it in GitHub Desktop.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
});
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseForwardedHeaders();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment