Route requests to different services
Serve a frontend and API under one public domain with HTTP path routes.
Run a frontend on port 3000 and an API on port 8080. This example assumes the API serves paths beginning with /api, including /api/health.
Configure the routes
Save as tubu.yml:
tunnels:
- type: http
domain: my-app.tubu.dev
target: 3000
routes:
- path: /api
target: 8080npx tubu-cli --config tubu.ymlRequests under /api go to port 8080; other requests go to port 3000. See route matching rules.
Verify each destination
curl --fail https://my-app.tubu.dev/
curl --fail https://my-app.tubu.dev/api/healthExpect the frontend at / and the API response at /api/health. Routes preserve their prefix by default. If your API serves /health instead, add a route rewrite using the rewrite guide.