Path Rewriting Settings
This reference covers all of Pomerium's Path Rewriting Settings:
Prefix Rewrite
If set, Prefix Rewrite indicates that during forwarding, the matched prefix (or path) should be swapped with this value.
How to configure
- Core
- Enterprise
- Kubernetes
YAML/JSON setting | Type | Usage |
---|---|---|
prefix_rewrite | string | optional |
Configure Prefix Rewrite in the Console:
- Set the Prefix in Path Matching settings:
- Set the Prefix Rewrite in Path Rewriting settings:
Name | Type | Usage |
---|---|---|
prefix_rewrite | string | optional |
See Kubernetes Ingress for more information
Examples
from: https://from.example.com
to: https://to.example.com
prefix: /admin
prefix_rewrite: /
A request to https://from.example.com/admin
would be forwarded to https://to.example.com/
.
Regex Rewrite
If Regex Rewrite or Regex Rewrite Substitution are set, the URL path will be rewritten according to the pattern and substitution, similar to prefix_rewrite
.
How to configure
- Core
- Enterprise
- Kubernetes
YAML/JSON setting | Type | Usage |
---|---|---|
regex_rewrite_pattern | string | optional |
regex_rewrite_substitution | string | optional |
Set Regex Rewrite pattern and substitution in the Console:
Kubernetes does not support Regex Rewrite
Examples
regex_rewrite_pattern: '^/service/([^/]+)(/.*)$'
regex_rewrite_substitution: "\\2/instance/\\1"