From c8ce6e8a2e331e8b73021b190d5fefda916cb96c Mon Sep 17 00:00:00 2001 From: token <239573049@qq.com> Date: Mon, 29 Jan 2024 14:26:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=9D=99=E6=80=81=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=BB=A3=E7=90=86=E6=97=A5=E5=BF=97=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Gateway/Middlewares/StaticFileProxyMiddleware.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Gateway/Middlewares/StaticFileProxyMiddleware.cs b/src/Gateway/Middlewares/StaticFileProxyMiddleware.cs index 634558d..0d689be 100644 --- a/src/Gateway/Middlewares/StaticFileProxyMiddleware.cs +++ b/src/Gateway/Middlewares/StaticFileProxyMiddleware.cs @@ -35,6 +35,7 @@ public class StaticFileProxyMiddleware(IContentTypeProvider contentTypeProvider) return; } + // 设置响应头 foreach (var header in staticFileProxyEntity.ResponseHeaders) { @@ -49,6 +50,8 @@ public class StaticFileProxyMiddleware(IContentTypeProvider contentTypeProvider) context.Request.Path = "/" + staticFileProxyEntity.Index; } + Console.WriteLine($"静态文件代理:{staticFileProxyEntity.Path} -> {staticFileProxyEntity.Root} Path > {context.Request.Path} "); + // 拼接静态文件的完整路径 var fileInfo = new FileInfo(Path.Combine(staticFilePath, context.Request.Path.Value?.TrimStart('/') ?? string.Empty));