Compare commits
2 Commits
bacb791ba9
...
6c8fdf875f
Author | SHA1 | Date |
---|---|---|
Simon | 6c8fdf875f | |
Simon | 55486aaedd |
|
@ -4,10 +4,19 @@ using Microsoft.AspNetCore.Authentication.Cookies;
|
|||
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Collections;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
var Configuration = builder.Configuration;
|
||||
|
||||
builder.Services.Configure<ForwardedHeadersOptions>(options =>
|
||||
{
|
||||
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
|
||||
|
||||
options.KnownNetworks.Clear();
|
||||
options.KnownProxies.Clear();
|
||||
});
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddRazorPages();
|
||||
builder.Services.AddControllers();
|
||||
|
@ -31,12 +40,7 @@ builder.Services.AddAuthentication(options => {
|
|||
|
||||
var app = builder.Build();
|
||||
|
||||
app.UseForwardedHeaders(new ForwardedHeadersOptions
|
||||
{
|
||||
RequireHeaderSymmetry = false,
|
||||
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
|
||||
});
|
||||
|
||||
app.UseForwardedHeaders();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
|
|
|
@ -27,7 +27,7 @@ http {
|
|||
|
||||
#gzip on;
|
||||
|
||||
# include /etc/nginx/conf.d/*.conf;
|
||||
# include /etc/nginx/conf.d/*.conf;
|
||||
|
||||
server {
|
||||
listen 9000;
|
||||
|
@ -58,10 +58,14 @@ http {
|
|||
}
|
||||
|
||||
location / {
|
||||
# Do preserve this
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
# again dont overwrite this
|
||||
#proxy_set_header X-Real-IP $remote_addr;
|
||||
# this just seems to append another ip ie <host>, <proxy>
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
# Preserve the scheme as https if behind another proxy
|
||||
#proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
proxy_connect_timeout 300;
|
||||
# Default is HTTP/1, keepalive is only enabled in HTTP/1.1
|
||||
|
|
Loading…
Reference in New Issue