我们正在运行一个服务nginx
代理以便:
http://service-post:8080/swagger-ui.html
被路由到公共地址https://host.com/services/post/swagger-ui.html
或者从另一种方式定义:
当nginx收到请求时https://host.com/services/post/swagger-ui.html
,它剥离了/services/post/
前缀并将请求传递给post
服务于/swagger-ui.html
path.
在设置任何内容之前(使用默认的 SpringDoc 配置),我可以正确地看到 swagger 文档http://service-post:8080/swagger-ui.html
.
要设置 host.com 上公共地址的路径,我使用:
springdoc.api-docs.path: /services/post/api-docs
springdoc.swagger-ui.path: /services/post/swagger-ui.html
springdoc.swagger-ui.configUrl: /services/post/v3/api-docs/swagger-config
然而,这似乎完全阻止了它:
/swagger-ui.html
, /api-docs
and /v3/api-docs/swagger-config
return 404
两者都是为了service-post:8080/*
and https://host.com/services/post/*
唯一有效的似乎是https://host.com/services/post/swagger-ui/index.html其中显示了 petstore 文档。
我们没有使用 Spring Boot,只是Spring MVC的版本5.3.1.
那么我该如何设置才能保留原始路径的处理(例如/api-docs
),但在前缀路径(/services/post/api-docs
)?