mirror of
https://github.com/nsnail/IGeekFan.AspNetCore.Knife4jUI.git
synced 2025-04-13 19:52:50 +08:00
#26 fix RoutePrefix nginx代理路径无效的问题
This commit is contained in:
parent
1e9fb7d195
commit
99fd092b24
@ -45,6 +45,7 @@ namespace IGeekFan.AspNetCore.Knife4jUI
|
||||
|
||||
public async Task Invoke(HttpContext httpContext)
|
||||
{
|
||||
|
||||
var httpMethod = httpContext.Request.Method;
|
||||
var path = httpContext.Request.Path.Value;
|
||||
|
||||
@ -66,7 +67,7 @@ namespace IGeekFan.AspNetCore.Knife4jUI
|
||||
return;
|
||||
}
|
||||
|
||||
if (httpMethod == "GET" && Regex.IsMatch(path, $"^/swagger-resources$"))
|
||||
if (httpMethod == "GET" && Regex.IsMatch(path, $"/swagger-resources$"))
|
||||
{
|
||||
await RespondWithConfig(httpContext.Response);
|
||||
return;
|
||||
@ -74,7 +75,7 @@ namespace IGeekFan.AspNetCore.Knife4jUI
|
||||
|
||||
await _staticFileMiddleware.Invoke(httpContext);
|
||||
}
|
||||
|
||||
|
||||
private async Task RespondWithConfig(HttpResponse response)
|
||||
{
|
||||
await response.WriteAsync(JsonSerializer.Serialize(_options.ConfigObject.Urls, _jsonSerializerOptions));
|
||||
|
Loading…
x
Reference in New Issue
Block a user