Unleash / unleash-proxy

Unleash Proxy is used to safely integrate frontend application with Unleash in a secure and scaleable way.
https://docs.getunleash.io/sdks/unleash-proxy
Apache License 2.0
53 stars 43 forks source link

fix: make the swagger UI work correctly when using PROXY_BASE_PATH #133

Closed thomasheartman closed 1 year ago

thomasheartman commented 1 year ago

This PR changes the server property of the OpenAPI spec that we serve to make it work when you provide a proxy base path.

The way we have the spec set up, we'll only ever have a single server, so there's no point in providing the base url the way we used to. According to the OpenAPI spec, an empty list will make it fall back to the default, which is /.

The only difference you'll see in the UI from before is that the servers dropdown is gone.

image

Discussion

Ideally, I think we would like the /base/path to be part of the server base path and not a prefix to each and every API endpoint. However, as we have seen in Unleash (https://github.com/Unleash/unleash/pull/2079), that isn't trivial.

This PR should fix the problem for now. If we want to, we can make the improvement later.

closes #125