MedAziz11/Uptime-Kuma-Web-API

Allow the application to run under a given URL path?

C-Duv opened this issue ยท 5 comments

C-Duv commented

Could the application be configured to run under a specific URL path.

Say I want to make it available at URL https://monitoring.example.com/uptime-api/

I can, from my web reverse proxy, strip the /uptime-api part prior to passing it to the Docker container running the medaziz11/uptimekuma_restapi image. But in the obtained response contains URL that refers to the root of the server.

Thus, when I try to access https://monitoring.example.com/uptime-api/, I get a location: /docs HTTP 307 response.

If I try to access https://monitoring.example.com/uptime-api/docs, I get the correct HTML document but it asks for /openapi.json, not https://monitoring.example.com/uptime-api/openapi.json.

If there was some configuration/option to declare the path the application is expected to execute from it would be useful.

(I guess can submit a PR for this)

C-Duv commented

I've just started a simple patch to address this issue: I'll check/test it later and submit a PR if it's working just fine.

C-Duv commented

I fail to achieve what I want.

Using app = FastAPI(title=app_settings.PROJECT_NAME, root_path="/the_api"):

  • The Swagger UI web client is available at https://server.example.com/the_api/docs ๐Ÿ‘
  • Which loads openapi.json from https://server.example.com/the_api/openapi.json ๐Ÿ‘

But paths in openapi.json lacks the /the_api prefix so Swagger UI is not working. ๐Ÿ˜“

The more I dig the more I'm not really sure FastAPI can prefix URLs in openapi.json.

C-Duv commented

There are ideas in this FastAPI issue fastapi/fastapi#829 I need to try.

Any progress here @C-Duv ? I am having a similar issue.

No, I failed to find the correct settings or hack so I ended up using a dedicated FQDN for the API.