mirror of
https://github.com/containous/traefik.git
synced 2025-11-19 16:24:21 +03:00
Add dedicated pages for routers and fix doc links in CRDs
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
---
|
||||
title: "Traefik HTTP Routers Documentation"
|
||||
description: "HTTP routers are responsible for connecting incoming requests to the services that can handle them. Read the technical documentation."
|
||||
---
|
||||
|
||||
## HTTP Router
|
||||
|
||||
An HTTP router is in charge of connecting incoming requests to the services that can handle them. Routers analyze incoming requests based on rules, and when a match is found, forward the request through any configured middlewares to the appropriate service.
|
||||
|
||||
## Configuration Example
|
||||
|
||||
```yaml tab="Structured (YAML)"
|
||||
http:
|
||||
routers:
|
||||
my-router:
|
||||
entryPoints:
|
||||
- "web"
|
||||
- "websecure"
|
||||
rule: "Host(`example.com`) && Path(`/api`)"
|
||||
priority: 10
|
||||
middlewares:
|
||||
- "auth"
|
||||
- "ratelimit"
|
||||
tls:
|
||||
certResolver: "letsencrypt"
|
||||
observability:
|
||||
metrics: true
|
||||
accessLogs: true
|
||||
tracing: true
|
||||
service: my-service
|
||||
```
|
||||
|
||||
```toml tab="Structured (TOML)"
|
||||
[http.routers]
|
||||
[http.routers.my-router]
|
||||
entryPoints = ["web", "websecure"]
|
||||
rule = "Host(`example.com`) && Path(`/api`)"
|
||||
priority = 10
|
||||
middlewares = ["auth", "ratelimit"]
|
||||
service = "my-service"
|
||||
|
||||
[http.routers.my-router.tls]
|
||||
certResolver = "letsencrypt"
|
||||
|
||||
[http.routers.my-router.observability]
|
||||
metrics = true
|
||||
accessLogs = true
|
||||
tracing = true
|
||||
```
|
||||
|
||||
```yaml tab="Labels"
|
||||
labels:
|
||||
- "traefik.http.routers.my-router.entrypoints=web,websecure"
|
||||
- "traefik.http.routers.my-router.rule=Host(`example.com`) && Path(`/api`)"
|
||||
- "traefik.http.routers.my-router.priority=10"
|
||||
- "traefik.http.routers.my-router.middlewares=auth,ratelimit"
|
||||
- "traefik.http.routers.my-router.service=my-service"
|
||||
- "traefik.http.routers.my-router.tls.certresolver=letsencrypt"
|
||||
- "traefik.http.routers.my-router.observability.metrics=true"
|
||||
- "traefik.http.routers.my-router.observability.accessLogs=true"
|
||||
- "traefik.http.routers.my-router.observability.tracing=true"
|
||||
```
|
||||
|
||||
```json tab="Tags"
|
||||
{
|
||||
"Tags": [
|
||||
"traefik.http.routers.my-router.entrypoints=web,websecure",
|
||||
"traefik.http.routers.my-router.rule=Host(`example.com`) && Path(`/api`)",
|
||||
"traefik.http.routers.my-router.priority=10",
|
||||
"traefik.http.routers.my-router.middlewares=auth,ratelimit",
|
||||
"traefik.http.routers.my-router.service=my-service",
|
||||
"traefik.http.routers.my-router.tls.certresolver=letsencrypt",
|
||||
"traefik.http.routers.my-router.observability.metrics=true",
|
||||
"traefik.http.routers.my-router.observability.accessLogs=true",
|
||||
"traefik.http.routers.my-router.observability.tracing=true"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Configuration Options
|
||||
|
||||
| Field | Description | Default | Required |
|
||||
|------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|----------|
|
||||
| <a id="entryPoints" href="#entryPoints" title="#entryPoints">`entryPoints`</a> | The list of entry points to which the router is attached. If not specified, HTTP routers are attached to all entry points. | All entry points | No |
|
||||
| <a id="rule" href="#rule" title="#rule">`rule`</a> | Rules are a set of matchers configured with values, that determine if a particular request matches specific criteria. If the rule is verified, the router becomes active, calls middlewares, and then forwards the request to the service. See [Rules & Priority](./rules-and-priority.md) for details. | | Yes |
|
||||
| <a id="priority" href="#priority" title="#priority">`priority`</a> | To avoid path overlap, routes are sorted, by default, in descending order using rules length. The priority is directly equal to the length of the rule, and so the longest length has the highest priority. A value of `0` for the priority is ignored. See [Rules & Priority](./rules-and-priority.md) for details. | Rule length | No |
|
||||
| <a id="middlewares" href="#middlewares" title="#middlewares">`middlewares`</a> | The list of middlewares that are applied to the router. Middlewares are applied in the order they are declared. See [Middlewares overview](../middlewares/overview.md) for available middlewares. | | No |
|
||||
| <a id="tls" href="#tls" title="#tls">`tls`</a> | TLS configuration for the router. When specified, the router will only handle HTTPS requests. See [TLS overview](../tls/overview.md) for detailed TLS configuration. | | No |
|
||||
| <a id="observability" href="#observability" title="#observability">`observability`</a> | Observability configuration for the router. Allows fine-grained control over access logs, metrics, and tracing per router. See [Observability](./observability.md) for details. | Inherited from entry points | No |
|
||||
| <a id="service" href="#service" title="#service">`service`</a> | The name of the service that will handle the matched requests. Services can be load balancer services, weighted round robin, mirroring, or failover services. See [Service](../load-balancing/service.md) for details.| | Yes |
|
||||
|
||||
|
||||
## Router Naming
|
||||
|
||||
- The character `@` is not authorized in the router name
|
||||
- In provider-specific configurations (Docker, Kubernetes), router names are often auto-generated based on service names and rules
|
||||
@@ -0,0 +1,86 @@
|
||||
---
|
||||
title: "Traefik TCP Routers Documentation"
|
||||
description: "TCP routers are responsible for connecting incoming TCP connections to the services that can handle them. Read the technical documentation."
|
||||
---
|
||||
|
||||
## TCP Router
|
||||
|
||||
A TCP router is in charge of connecting incoming TCP connections to the services that can handle them. TCP routers analyze incoming connections based on rules, and when a match is found, forward the connection through any configured middlewares to the appropriate service.
|
||||
|
||||
!!! note "TCP vs HTTP Routing"
|
||||
If both HTTP routers and TCP routers listen to the same EntryPoint, the TCP routers will apply before the HTTP routers. If no matching route is found for the TCP routers, then the HTTP routers will take over.
|
||||
|
||||
## Configuration Example
|
||||
|
||||
```yaml tab="Structured (YAML)"
|
||||
tcp:
|
||||
routers:
|
||||
my-tcp-router:
|
||||
entryPoints:
|
||||
- "tcp-ep"
|
||||
- "websecure"
|
||||
rule: "HostSNI(`example.com`)"
|
||||
priority: 10
|
||||
middlewares:
|
||||
- "tcp-ipallowlist"
|
||||
tls:
|
||||
passthrough: false
|
||||
certResolver: "letsencrypt"
|
||||
service: my-tcp-service
|
||||
```
|
||||
|
||||
```toml tab="Structured (TOML)"
|
||||
[tcp.routers]
|
||||
[tcp.routers.my-tcp-router]
|
||||
entryPoints = ["tcp-ep", "websecure"]
|
||||
rule = "HostSNI(`example.com`)"
|
||||
priority = 10
|
||||
middlewares = ["tcp-ipallowlist"]
|
||||
service = "my-tcp-service"
|
||||
|
||||
[tcp.routers.my-tcp-router.tls]
|
||||
passthrough = false
|
||||
certResolver = "letsencrypt"
|
||||
```
|
||||
|
||||
```yaml tab="Labels"
|
||||
labels:
|
||||
- "traefik.tcp.routers.my-tcp-router.entrypoints=tcp-ep,websecure"
|
||||
- "traefik.tcp.routers.my-tcp-router.rule=HostSNI(`example.com`)"
|
||||
- "traefik.tcp.routers.my-tcp-router.priority=10"
|
||||
- "traefik.tcp.routers.my-tcp-router.middlewares=tcp-ipallowlist"
|
||||
- "traefik.tcp.routers.my-tcp-router.tls.certresolver=letsencrypt"
|
||||
- "traefik.tcp.routers.my-tcp-router.tls.passthrough=false"
|
||||
- "traefik.tcp.routers.my-tcp-router.service=my-tcp-service"
|
||||
```
|
||||
|
||||
```json tab="Tags"
|
||||
{
|
||||
"Tags": [
|
||||
"traefik.tcp.routers.my-tcp-router.entrypoints=tcp-ep,websecure",
|
||||
"traefik.tcp.routers.my-tcp-router.rule=HostSNI(`example.com`)",
|
||||
"traefik.tcp.routers.my-tcp-router.priority=10",
|
||||
"traefik.tcp.routers.my-tcp-router.middlewares=tcp-ipallowlist",
|
||||
"traefik.tcp.routers.my-tcp-router.tls.certresolver=letsencrypt",
|
||||
"traefik.tcp.routers.my-tcp-router.tls.passthrough=false",
|
||||
"traefik.tcp.routers.my-tcp-router.service=my-tcp-service"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Configuration Options
|
||||
|
||||
| Field | Description | Default | Required |
|
||||
|------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|----------|
|
||||
| <a id="entryPoints" href="#entryPoints" title="#entryPoints">`entryPoints`</a> | The list of entry points to which the router is attached. If not specified, TCP routers are attached to all TCP entry points. | All TCP entry points | No |
|
||||
| <a id="rule" href="#rule" title="#rule">`rule`</a> | Rules are a set of matchers configured with values, that determine if a particular connection matches specific criteria. If the rule is verified, the router becomes active, calls middlewares, and then forwards the connection to the service. See [Rules & Priority](./rules-and-priority.md) for details. | | Yes |
|
||||
| <a id="priority" href="#priority" title="#priority">`priority`</a> | To avoid rule overlap, routes are sorted, by default, in descending order using rules length. The priority is directly equal to the length of the rule, and so the longest length has the highest priority. A value of `0` for the priority is ignored. See [Rules & Priority](./rules-and-priority.md) for details. | Rule length | No |
|
||||
| <a id="middlewares" href="#middlewares" title="#middlewares">`middlewares`</a> | The list of middlewares that are applied to the router. Middlewares are applied in the order they are declared. See [TCP Middlewares overview](../middlewares/overview.md) for available TCP middlewares. | | No |
|
||||
| <a id="tls" href="#tls" title="#tls">`tls`</a> | TLS configuration for the router. When specified, the router will only handle TLS connections. See [TLS configuration](../tls.md) for detailed TLS options. | | No |
|
||||
| <a id="service" href="#service" title="#service">`service`</a> | The name of the service that will handle the matched connections. Services can be load balancer services or weighted round robin services. See [TCP Service](../service.md) for details. | | Yes |
|
||||
|
||||
## Router Naming
|
||||
|
||||
- The character `@` is not authorized in the router name
|
||||
- Router names should be descriptive and follow your naming conventions
|
||||
- In provider-specific configurations (Docker, Kubernetes), router names are often auto-generated based on service names and rules
|
||||
@@ -0,0 +1,69 @@
|
||||
---
|
||||
title: "Traefik UDP Routers Documentation"
|
||||
description: "UDP routers are responsible for connecting incoming UDP packets to the services that can handle them. Read the technical documentation."
|
||||
---
|
||||
|
||||
## UDP Router
|
||||
|
||||
A UDP router is in charge of connecting incoming UDP packets to the services that can handle them. Unlike HTTP and TCP routers, UDP routers operate at the transport layer and have unique characteristics due to the connectionless nature of UDP.
|
||||
|
||||
!!! important "UDP Router Characteristics"
|
||||
- UDP is connectionless, so there is no concept of a request URL path or Host SNI to match against
|
||||
- UDP routers are essentially load-balancers that distribute packets to backend services
|
||||
- UDP routers can only target UDP services (not HTTP or TCP services)
|
||||
- Sessions are tracked with configurable timeouts to maintain state between client and backend
|
||||
|
||||
## Configuration Example
|
||||
|
||||
```yaml tab="Structured (YAML)"
|
||||
udp:
|
||||
routers:
|
||||
my-udp-router:
|
||||
entryPoints:
|
||||
- "udp-ep"
|
||||
- "dns"
|
||||
service: my-udp-service
|
||||
```
|
||||
|
||||
```toml tab="Structured (TOML)"
|
||||
[udp.routers]
|
||||
[udp.routers.my-udp-router]
|
||||
entryPoints = ["udp-ep", "dns"]
|
||||
service = "my-udp-service"
|
||||
```
|
||||
|
||||
```yaml tab="Labels"
|
||||
labels:
|
||||
- "traefik.udp.routers.my-udp-router.entrypoints=udp-ep,dns"
|
||||
- "traefik.udp.routers.my-udp-router.service=my-udp-service"
|
||||
```
|
||||
|
||||
```json tab="Tags"
|
||||
{
|
||||
"Tags": [
|
||||
"traefik.udp.routers.my-udp-router.entrypoints=udp-ep,dns",
|
||||
"traefik.udp.routers.my-udp-router.service=my-udp-service"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Configuration Options
|
||||
|
||||
| Field | Description | Default | Required |
|
||||
|------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|----------|
|
||||
| <a id="entryPoints" href="#entryPoints" title="#entryPoints">`entryPoints`</a> | The list of entry points to which the router is attached. If not specified, UDP routers are attached to all UDP entry points. | All UDP entry points | No |
|
||||
| <a id="service" href="#service" title="#service">`service`</a> | The name of the service that will handle the matched UDP packets. UDP services are typically load balancer services that distribute packets to multiple backend servers. See [UDP Service](../service.md) for details. | | Yes |
|
||||
|
||||
## Sessions and Timeout
|
||||
|
||||
Even though UDP is connectionless, Traefik's UDP router implementation relies on sessions to maintain state about ongoing communication between clients and backends. This allows the proxy to know where to forward response packets from backends.
|
||||
|
||||
Each session has an associated timeout that cleans up inactive sessions after a specified duration of inactivity.
|
||||
|
||||
Session timeout can be configured using the `entryPoints.name.udp.timeout` option in the static configuration. See [EntryPoints documentation](../../install-configuration/entrypoints.md) for details.
|
||||
|
||||
## Router Naming
|
||||
|
||||
- The character `@` is not authorized in the router name
|
||||
- Router names should be descriptive and follow your naming conventions
|
||||
- In provider-specific configurations (Docker, Kubernetes), router names are often auto-generated based on service names
|
||||
Reference in New Issue
Block a user