MedAziz11 / Uptime-Kuma-Web-API

Uptime Kuma REST API
215 stars 44 forks source link

Allow the application to run under a given URL path? #57

Open C-Duv opened 1 year ago

C-Duv commented 1 year ago

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 1 year ago

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 11 months ago

I fail to achieve what I want.

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

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 11 months ago

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

stevencarlislewalker commented 10 months ago

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

C-Duv commented 10 months ago

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