-
Notifications
You must be signed in to change notification settings - Fork 35
Description
Describe the feature
Context: Asked by @schiller-manuel
How can I set a custom base path in srvx?
Sometimes it is useful to serve requests under a base URL to match the production environment.
While srvx (web Request) does not have a concept of base URL, we could emulate it by rewriting the request in a middleware (from /srvx/base-url similar to logger #94), and we can do path rewrite similar to h3.mount
We might need a fallback approach when the base is set to /base and users hit a path like /foo/bar, which needs to be redirected to /base/foo/bar. We need to do this redirect after next() if the response is 404 to allow the user-handler to optionally take over out-of-base situations.
We can also integrate middleware with CLI using an option like --base to add base url.
Additional information
- Would you be willing to help implement this feature?