Merge pull request '让Swagger可以调试Nginx二级目录转发的地址' (#220) from koy07555/Admin.NET.Pro:让Nginx二级目录支持Swagger into v2
Reviewed-on: http://101.43.53.74:3000/Admin.NET/Admin.NET.Pro/pulls/220
This commit is contained in:
commit
eb63382891
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
|
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
|
||||||
|
|
||||||
"SpecificationDocumentSettings": {
|
"SpecificationDocumentSettings": {
|
||||||
@ -22,6 +22,14 @@
|
|||||||
"DefaultGroupName": "Default", // 默认分组名
|
"DefaultGroupName": "Default", // 默认分组名
|
||||||
"DocExpansionState": "List", // List、Full、None
|
"DocExpansionState": "List", // List、Full、None
|
||||||
"EnableAllGroups": true,
|
"EnableAllGroups": true,
|
||||||
|
//"ServerDir": "t490", // Nginx 有二级目录的,把二级目录设置在这里,并且开启 Servers的选择列表
|
||||||
|
"HideServers": false,
|
||||||
|
"Servers": [
|
||||||
|
{
|
||||||
|
"Url": "https://ip/二级",
|
||||||
|
"Description": "发布地址名称"
|
||||||
|
}
|
||||||
|
],
|
||||||
"LoginInfo": {
|
"LoginInfo": {
|
||||||
"Enabled": true, // 是否开启Swagger登录
|
"Enabled": true, // 是否开启Swagger登录
|
||||||
"CheckUrl": "/api/swagger/checkUrl",
|
"CheckUrl": "/api/swagger/checkUrl",
|
||||||
|
|||||||
@ -356,9 +356,13 @@ public class Startup : AppStartup
|
|||||||
app.UseKnife4UI(options =>
|
app.UseKnife4UI(options =>
|
||||||
{
|
{
|
||||||
options.RoutePrefix = "kapi";
|
options.RoutePrefix = "kapi";
|
||||||
|
options.ConfigObject.DisplayOperationId = true;
|
||||||
|
options.ConfigObject.DisplayRequestDuration = true;
|
||||||
foreach (var groupInfo in SpecificationDocumentBuilder.GetOpenApiGroups())
|
foreach (var groupInfo in SpecificationDocumentBuilder.GetOpenApiGroups())
|
||||||
{
|
{
|
||||||
options.SwaggerEndpoint("/" + groupInfo.RouteTemplate, groupInfo.Title);
|
// 这里因为兼容 Nginx 使用二级目录转发的情况
|
||||||
|
// Nginx 配置了二级域名转发,还要使用 Swagger.json 的 ServerDir 配置项
|
||||||
|
options.SwaggerEndpoint(".." + groupInfo.RouteTemplate.Substring(groupInfo.RouteTemplate.IndexOf("/swagger/")), groupInfo.Title);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user