DocsTelepresence2.16Types of intercepts
Types of intercepts
Personal intercept
Personal intercepts allow you to be selective and intercept only some of the traffic to a service while not interfering with the rest of the traffic. This allows you to share a cluster with others on your team without interfering with their work.
Personal intercepts are subject to different plans. To read more about their capabilities & limits, see the subscription management page.
In the illustration above, Orange requests are being made by Developer 2 on their laptop and the green are made by a teammate, Developer 1, on a different laptop.
Each developer can intercept the Orders service for their requests only, while sharing the rest of the development environment.
Creating and using personal intercepts
Creating the intercept: Intercept your service from your CLI:
We're using
Personal-Intercept=126a72c7-be8b-4329-af64-768e207a184b
as the header for the sake of the example, but you can use anykey=value
pair you want, or--http-header=auto
to have it choose something automatically.Using the intercept: Send requests to your service by passing the HTTP header:
Using the intercept: Send requests to your service without the HTTP header:
Requests without the header will be sent to the version of your service that is running in the cluster. This enables you to share the cluster with a team!
Intercepting a specific endpoint
It's not uncommon to have one service serving several endpoints. Telepresence is capable of limiting an
intercept to only affect the endpoints you want to work with by using one of the --http-path-xxx
flags below in addition to using --http-header
flags. Only one such flag can be used in an intercept
and, contrary to the --http-header
flag, it cannot be repeated.
The following flags are available:
Flag | Meaning |
---|---|
--http-path-equal <path> | Only intercept the endpoint for this exact path |
--http-path-prefix <prefix> | Only intercept endpoints with a matching path prefix |
--http-path-regex <regex> | Only intercept endpoints that match the given regular expression |
Examples:
A personal intercept using the header "Coder: Bob" limited to all endpoints that start with "/api':
A personal intercept using the auto generated header that applies only to the endpoint "/api/version":
or, since
--http-header=auto
is the implicit when using--http
options, just:A personal intercept using the auto generated header limited to all endpoints matching the regular expression "(staging-)?api/.*":