How do I configure path-based routing in Porter?

Last updated: February 10, 2026

Context

When deploying applications in Kubernetes, it's common to need to route traffic to different services based on URL paths. For example, you might want to route requests with paths starting with `/v0/` to a backend service, while routing all other traffic to a frontend service. While this can be accomplished using nginx ingress rules in raw Kubernetes, Porter provides a simpler way to achieve the same functionality.

Answer

In Porter, you can configure path-based routing using the `porter.yaml` configuration file. This is accomplished through the `pathRouting` and `pathRoutingConfig` blocks in your web service configuration.

To implement path-based routing:

  1. Create or modify your `porter.yaml` file

  2. Use the `pathRouting` property to define which service should handle specific paths

  3. Configure the routing rules using `pathRoutingConfig` to specify path prefixes and corresponding services

For detailed implementation instructions and configuration options, refer to: