javalin / javalin-openapi

Annotation processor for compile-time OpenAPI & JsonSchema, with out-of-the-box support for Javalin 5.x, Swagger & ReDoc
https://github.com/javalin/javalin-openapi/wiki
Apache License 2.0
45 stars 17 forks source link

Swagger behind a proxy #190

Closed ysavourel closed 1 year ago

ysavourel commented 1 year ago

Hi, I'm using Javalin behind a proxy and can't make Swagger to work properly. Without the proxy, things are running ok: the Swagger page work (https//abc-test.example.com:7000/swagger) With the proxy I get an extra "dr" suffix that apparently breaks path to the resources (https//api-abc.example.com/dr/swagger).

According the old issue here https://github.com/javalin/javalin/issues/1237 there is a way to specify a path for the Webjars. I assume this is SwaggerConfiguration.setWebJarPath() in the new plugin, but what to change from the default path I get (/webjars/swagger-ui)? I have tried a few combinations, including trying to make the path relative, but all without success.

Any pointer would appreciated. Thanks -yves

dzikoysk commented 1 year ago

Hi, you should be able to set custom basePath in cfg:

https://github.com/javalin/javalin-openapi/blob/b5d3fcf1a50b8c45a21ca286ecc5342baee12f43/javalin-plugins/javalin-swagger-plugin/src/main/kotlin/io/javalin/openapi/plugin/swagger/SwaggerPlugin.kt#L15-L16

In your case, it'd be /dr

dzikoysk commented 1 year ago

Also: #130