Rewrite request paths
Remove a public path prefix before forwarding a request to an HTTP target.
Run a frontend on port 3000 and an API on port 8080 that serves /health. You will expose the API as /api/health.
Strip a route prefix
Save as tubu.yml:
tunnels:
- type: http
domain: my-app.tubu.dev
target: 3000
routes:
- path: /api
target: 8080
rewrites:
- ["^/api(/|$)", "/"]npx tubu-cli --config tubu.ymlThe relay selects /api first. The CLI then changes /api/health to /health. /api becomes /. The query string is preserved.
Verify the rewritten request
curl --fail 'https://my-app.tubu.dev/api/health?check=1'Expect the response from /health?check=1 on port 8080.
Use the rewrite reference for supported pattern and substitution syntax.