Skip to content
This repository was archived by the owner on Dec 21, 2022. It is now read-only.

Commit a6eb230

Browse files
committed
feat: 支持反向代理 Header
1 parent e2ea19a commit a6eb230

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/MaaCopilotServer.Api/Program.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using MaaCopilotServer.Infrastructure;
1818
using MaaCopilotServer.Resources;
1919
using Microsoft.AspNetCore.Http.Features;
20+
using Microsoft.AspNetCore.HttpOverrides;
2021
using Microsoft.AspNetCore.StaticFiles;
2122
using Microsoft.Extensions.FileProviders;
2223
using Serilog;
@@ -67,8 +68,15 @@ public static void Main()
6768
builder.Services.AddApiServices(configuration);
6869
builder.Services.AddMaaSwagger();
6970

71+
builder.Services.Configure<ForwardedHeadersOptions>(options =>
72+
{
73+
options.ForwardedHeaders = ForwardedHeaders.All;
74+
});
75+
7076
var app = builder.Build();
7177

78+
app.UseForwardedHeaders();
79+
7280
app.UseMaaSwagger();
7381

7482
// CORS settings.

0 commit comments

Comments
 (0)