> ## Documentation Index
> Fetch the complete documentation index at: https://tyk.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Routing Traffic

> Learn how Tyk Gateway routes incoming requests to their destinations

Tyk Gateway sits between clients and upstream services, receiving every API request and deciding where it goes. This section covers the mechanisms that control those decisions: how Tyk identifies which API and endpoint owns a request, where it sends the matched request, and what happens when the standard request-response flow needs to be modified or bypassed.

## The Request Journey

A request arriving at Tyk passes through a sequence of routing stages.

**[Matching](/5.13/getting-started/key-concepts/url-matching):** Tyk compares the incoming request against all configured APIs to find the one whose listen path matches the
request URL. Within that API, it identifies the endpoint whose path pattern matches. No further processing occurs until a
match is found.

**[Forwarding](/5.13/planning-for-production/ensure-high-availability/load-balancing):** Tyk forwards the matched request to the configured upstream target. Where multiple targets are configured,
load balancing distributes traffic across them. Where upstream addresses are dynamic, [service discovery](/5.13/planning-for-production/ensure-high-availability/service-discovery) resolves the current
target at request time.

**[Path Modification](/5.13/transform-traffic/url-rewriting):** Before forwarding, the request path can be rewritten. This handles cases where the path a client
sends differs from the path the upstream expects, or where request content should determine the destination.

**[Internal Routing](/5.13/advanced-configuration/transform-traffic/looping):** Rather than forwarding to an external upstream, a request can be routed to another API or endpoint
within the same Tyk instance using the `tyk://` addressing scheme. This enables multi-step processing pipelines that stay
entirely inside the gateway.

**[Request Termination](/5.13/api-management/traffic-transformation/mock-response):** Some requests are handled entirely by the gateway and never reach an upstream. A mock response, for
example, returns a pre-configured static payload directly to the client.

## Protocol Support

The stages above apply to all traffic Tyk handles. Where behavior differs for [gRPC](/5.13/key-concepts/grpc-proxy), [WebSocket](/5.13/advanced-configuration/websockets), [Server-Sent Events](/5.13/advanced-configuration/sse-proxy), or [TCP](/5.13/key-concepts/tcp-proxy) traffic, the relevant page notes the difference.
