asp.net core 设置nginx proxy代理服务器转发后,无法访问swagger的问题 (Swashbuckle )
2021-03-15 05:29
标签:swagger ash point 导致 tutorials api git lob tutorial 通过代理转发后,webapi的swagger无法访问,本质原因是代理后url路径发生变化导致/swagger无法定位到json。 相关issue: https://github.com/microsoft/service-fabric-issues/issues/327 issue评论中,一般推荐通过PreSerializeFilters设置BasePath的方案,但在5.x版本中BasePath被删除了。最终选择使用设置相对路径的方案: 代码请见 https://github.com/wswind/swagger-under-nginx/blob/f5f6f89cb7f109059f5b4c9524a7ccbb401bc59a/Startup.cs#L56 asp.net core 设置nginx proxy代理服务器转发后,无法访问swagger的问题 (Swashbuckle ) 标签:swagger ash point 导致 tutorials api git lob tutorial 原文地址:https://www.cnblogs.com/wswind/p/swagger-proxy-problem.html#https://docs.microsoft.com/en-us/aspnet/core/tutorials/getting-started-with-swashbuckle
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/662
https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/427
https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/380
https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/380#issuecomment-374711180app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("v1/swagger.json", "My API V1");
});
下一篇:php怎么向上取整以5为界
文章标题:asp.net core 设置nginx proxy代理服务器转发后,无法访问swagger的问题 (Swashbuckle )
文章链接:http://soscw.com/index.php/essay/64829.html