Added Forwarding fix for swagger behind a reverse proxy
This commit is contained in:
		@@ -2,6 +2,7 @@ using System;
 | 
			
		||||
using System.Text.Json.Serialization;
 | 
			
		||||
using Microsoft.AspNetCore.Builder;
 | 
			
		||||
using Microsoft.AspNetCore.Hosting;
 | 
			
		||||
using Microsoft.AspNetCore.HttpOverrides;
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
using Microsoft.Extensions.Configuration;
 | 
			
		||||
using Microsoft.Extensions.DependencyInjection;
 | 
			
		||||
@@ -37,6 +38,10 @@ namespace ScrumTaskboard
 | 
			
		||||
                .UseNpgsql(GetConnectionString())
 | 
			
		||||
                .Options));
 | 
			
		||||
            services.AddControllers();
 | 
			
		||||
            services.Configure<ForwardedHeadersOptions>(options =>
 | 
			
		||||
            {
 | 
			
		||||
                options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
 | 
			
		||||
            });
 | 
			
		||||
            services.AddOpenApiDocument(
 | 
			
		||||
                config =>
 | 
			
		||||
                {
 | 
			
		||||
@@ -66,6 +71,10 @@ namespace ScrumTaskboard
 | 
			
		||||
 | 
			
		||||
            //app.UseHttpsRedirection();
 | 
			
		||||
            app.UseCors("AllowAll");
 | 
			
		||||
            app.UseForwardedHeaders(new ForwardedHeadersOptions
 | 
			
		||||
            {
 | 
			
		||||
                ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            app.UseRouting();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user