SMILEY4 / ktor-swagger-ui

Kotlin Ktor plugin to generate OpenAPI and provide Swagger UI
Apache License 2.0
156 stars 25 forks source link

add rootHostPath as configuration option #59

Closed s76527 closed 1 year ago

s76527 commented 1 year ago

I made an adjustment so i can host my app behind a reverse proxy with a custom context path. Without this, i have the problem, that the routing to the SwaggerUI module is broken and the api.json file can't be found.

SMILEY4 commented 1 year ago

Hi, thanks a lot for your pr.

I do have a question though i may be missing something: would just setting the swaggerUrl in the plugin-config work aswell.

So using the CompletePluginConfigExample.kt as an example:

instead of ...

swagger {
    swaggerUrl = "/api/swagger-ui"
    rootHostPath = "/my-ktor-web-app"
}

... could ...

swagger {
    swaggerUrl = "/my-ktor-web-app/api/swagger-ui"
}

... this also work and be enough ?

SMILEY4 commented 1 year ago

Ah, nevermind. Ignore my question 😄. PR looks fine, thanks again 👍 I'll publish it with the next version 2.3.0 as soon as possible.