temporalio / api

Temporal gRPC API and proto files
https://temporal.io
MIT License
77 stars 65 forks source link

Add configurable subpath for HTTP API #427

Open stevekinney opened 6 days ago

stevekinney commented 6 days ago

The change made in #410 causes a few potential problems for integrating with the UI.

First, some users host UI Server at a subpath and set both the client-side and API routes.

route.SetAPIRoutes(e, cfgProvider, serverOpts.APIMiddleware)
route.SetUIRoutes(e, cfg.PublicPath, assets)

Secondly, not having a sub-path for the API routes means that they will likely conflict with client-side UI routes. The current implementation of the UI passes through all routes with /api/v1 to UI Server. If both the pages and the API routes have the same path, it will be trickier to correctly implement the passthrough functionality.

Suggested resolutions:

cretz commented 6 days ago

The path for the API routes should be configurable.

I have opened https://github.com/temporalio/temporal/issues/6212 (this is not done in this repo, it's part of the server that sets up the API)

The change made in https://github.com/temporalio/api/pull/410 causes a few potential problems for integrating with the UI. [...] They should default to something (e.g. /api) and not be set at the root by default since

We do have stable roots of /namespaces, /cluster, and /system-info (opened https://github.com/temporalio/api/issues/428 to handle one we missed). We should never add more than those three. We do not serve anything from the literal /, we just removed some unnecessary API path parts, not the whole thing.