mirror of
https://github.com/nsnail/IGeekFan.AspNetCore.Knife4jUI.git
synced 2025-04-15 11:32:52 +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)
|
public async Task Invoke(HttpContext httpContext)
|
||||||
{
|
{
|
||||||
|
|
||||||
var httpMethod = httpContext.Request.Method;
|
var httpMethod = httpContext.Request.Method;
|
||||||
var path = httpContext.Request.Path.Value;
|
var path = httpContext.Request.Path.Value;
|
||||||
|
|
||||||
@ -66,7 +67,7 @@ namespace IGeekFan.AspNetCore.Knife4jUI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (httpMethod == "GET" && Regex.IsMatch(path, $"^/swagger-resources$"))
|
if (httpMethod == "GET" && Regex.IsMatch(path, $"/swagger-resources$"))
|
||||||
{
|
{
|
||||||
await RespondWithConfig(httpContext.Response);
|
await RespondWithConfig(httpContext.Response);
|
||||||
return;
|
return;
|
||||||
@ -74,7 +75,7 @@ namespace IGeekFan.AspNetCore.Knife4jUI
|
|||||||
|
|
||||||
await _staticFileMiddleware.Invoke(httpContext);
|
await _staticFileMiddleware.Invoke(httpContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task RespondWithConfig(HttpResponse response)
|
private async Task RespondWithConfig(HttpResponse response)
|
||||||
{
|
{
|
||||||
await response.WriteAsync(JsonSerializer.Serialize(_options.ConfigObject.Urls, _jsonSerializerOptions));
|
await response.WriteAsync(JsonSerializer.Serialize(_options.ConfigObject.Urls, _jsonSerializerOptions));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user