5 min • read

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 the Ambassador Cloud active service and user limit quotas. To read more about these quotas limits, see the subscription management page.

Loading...

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

  1. 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 any key=value pair you want, or --http-header=auto to have it choose something automatically.

  2. Using the intercept: Send requests to your service by passing the HTTP header:

  3. 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:

FlagMeaning
--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:

  1. A personal intercept using the header "Coder: Bob" limited to all endpoints that start with "/api':

  2. 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:

  3. A personal intercept using the auto generated header limited to all endpoints matching the regular expression "(staging-)?api/.*":