In this document, you will learn the basic concept of stream routes in APISIX and why you may need them.
Explore additional resources at the end of the document for more information on related topics.
In APISIX, a stream route object is used to create a route when APISIX functions as a stream proxy, operating on the transport layer for TCP and UDP connections. This is analogous to the concept of routes in cases where APISIX functions as an application-layer proxy.
The following diagram illustrates the concept of a stream route object. In this example, APISIX functions as a stream proxy for a MySQL server that uses TCP protocol for communication. APISIX is deployed at IP address
192.168.1.10 and configured to listen for TCP connections on port
client_addr field in the stream route filters on the client IP, ensuring that only requests originating from the specified IP address are allowed to pass through this route to the upstream MySQL server. While both clients have used the correct credentials to connect to the MySQL server, only the client with IP address whitelisted in
client_addr is permitted to establish a connection.
In addition to the
client_addr field, there are other fields such as
server_port that can be configured to filter incoming requests before rejecting or forwarding them to upstream services. To learn more about these fields and other configuration options, please refer to the Admin API reference for stream routes (coming soon).
For detailed instructions on how to configure APISIX as a stream proxy, see the Proxy Transport Layer (L4) Traffic how-to guide.