Uptime-Kuma-Web-API icon indicating copy to clipboard operation
Uptime-Kuma-Web-API copied to clipboard

Allow the application to run under a given URL path?

Open C-Duv opened this issue 1 year ago • 5 comments

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 avatar Oct 20 '23 09:10 C-Duv

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 avatar Oct 22 '23 20:10 C-Duv

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 avatar Dec 06 '23 16:12 C-Duv

There are ideas in this FastAPI issue https://github.com/tiangolo/fastapi/issues/829 I need to try.

C-Duv avatar Dec 06 '23 16:12 C-Duv

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

stevencarlislewalker avatar Jan 22 '24 20:01 stevencarlislewalker

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

C-Duv avatar Jan 22 '24 22:01 C-Duv