traefik/docs/content/routing/entrypoints.md

470 lines
13 KiB
Markdown
Raw Normal View History

# EntryPoints
2019-03-25 15:54:03 +00:00
Opening Connections for Incoming Requests
{: .subtitle }
2019-07-01 09:30:05 +00:00
![entryPoints](../assets/img/entrypoints.png)
EntryPoints are the network entry points into Traefik.
They define the port which will receive the requests (whether HTTP or TCP).
## Configuration Examples
??? example "Port 80 only"
2019-07-01 09:30:05 +00:00
```toml tab="File (TOML)"
2019-09-23 12:32:04 +00:00
## Static configuration
[entryPoints]
[entryPoints.web]
2019-07-01 09:30:05 +00:00
address = ":80"
```
```yaml tab="File (YAML)"
2019-09-23 12:32:04 +00:00
## Static configuration
2019-07-01 09:30:05 +00:00
entryPoints:
web:
address: ":80"
```
2019-07-02 15:36:04 +00:00
```bash tab="CLI"
2019-09-23 12:32:04 +00:00
## Static configuration
2019-07-01 09:30:05 +00:00
--entryPoints.web.address=:80
```
We define an `entrypoint` called `web` that will listen on port `80`.
??? example "Port 80 & 443"
2019-07-01 09:30:05 +00:00
```toml tab="File (TOML)"
2019-09-23 12:32:04 +00:00
## Static configuration
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.web-secure]
address = ":443"
```
2019-07-01 09:30:05 +00:00
```yaml tab="File (YAML)"
2019-09-23 12:32:04 +00:00
## Static configuration
2019-07-01 09:30:05 +00:00
entryPoints:
web:
address: ":80"
web-secure:
address: ":443"
```
2019-07-02 15:36:04 +00:00
```bash tab="CLI"
2019-09-23 12:32:04 +00:00
## Static configuration
2019-07-01 09:30:05 +00:00
--entryPoints.web.address=:80
--entryPoints.web-secure.address=:443
```
- Two entrypoints are defined: one called `web`, and the other called `web-secure`.
- `web` listens on port `80`, and `web-secure` on port `443`.
2019-09-23 12:32:04 +00:00
## Configuration
### General
EntryPoints are part of the [static configuration](../getting-started/configuration-overview.md#the-static-configuration).
You can define them using a toml file, CLI arguments, or a key-value store.
2019-09-23 12:32:04 +00:00
??? info "See the complete reference for the list of available options"
```toml tab="File (TOML)"
## Static configuration
[entryPoints]
[entryPoints.name]
address = ":8888"
[entryPoints.name.transport]
[entryPoints.name.transport.lifeCycle]
requestAcceptGraceTimeout = 42
graceTimeOut = 42
[entryPoints.name.transport.respondingTimeouts]
readTimeout = 42
writeTimeout = 42
idleTimeout = 42
[entryPoints.name.proxyProtocol]
insecure = true
trustedIPs = ["127.0.0.1", "192.168.0.1"]
[entryPoints.name.forwardedHeaders]
insecure = true
trustedIPs = ["127.0.0.1", "192.168.0.1"]
```
```yaml tab="File (YAML)"
## Static configuration
entryPoints:
name:
address: ":8888"
transport:
lifeCycle:
requestAcceptGraceTimeout: 42
graceTimeOut: 42
respondingTimeouts:
readTimeout: 42
writeTimeout: 42
idleTimeout: 42
proxyProtocol:
insecure: true
trustedIPs:
2019-09-23 15:00:06 +00:00
- "127.0.0.1"
- "192.168.0.1"
2019-09-23 12:32:04 +00:00
forwardedHeaders:
insecure: true
trustedIPs:
2019-09-23 15:00:06 +00:00
- "127.0.0.1"
- "192.168.0.1"
2019-09-23 12:32:04 +00:00
```
```bash tab="CLI"
## Static configuration
--entryPoints.name.address=:8888
--entryPoints.name.transport.lifeCycle.requestAcceptGraceTimeout=42
--entryPoints.name.transport.lifeCycle.graceTimeOut=42
--entryPoints.name.transport.respondingTimeouts.readTimeout=42
--entryPoints.name.transport.respondingTimeouts.writeTimeout=42
--entryPoints.name.transport.respondingTimeouts.idleTimeout=42
--entryPoints.name.proxyProtocol.insecure=true
--entryPoints.name.proxyProtocol.trustedIPs=127.0.0.1,192.168.0.1
2019-09-23 12:32:04 +00:00
--entryPoints.name.forwardedHeaders.insecure=true
--entryPoints.name.forwardedHeaders.trustedIPs=127.0.0.1,192.168.0.1
2019-09-23 12:32:04 +00:00
```
2019-08-26 12:40:04 +00:00
2019-09-23 12:32:04 +00:00
### Forwarded Header
2019-08-26 12:40:04 +00:00
2019-09-23 12:32:04 +00:00
You can configure Traefik to trust the forwarded headers information (`X-Forwarded-*`).
2019-09-23 12:32:04 +00:00
??? info "`forwardedHeaders.trustedIPs`"
Trusting Forwarded Headers from specific IPs.
2019-07-01 09:30:05 +00:00
```toml tab="File (TOML)"
2019-09-23 12:32:04 +00:00
## Static configuration
[entryPoints]
[entryPoints.web]
address = ":80"
2019-09-23 12:32:04 +00:00
[entryPoints.web.forwardedHeaders]
trustedIPs = ["127.0.0.1/32", "192.168.1.7"]
```
2019-07-01 09:30:05 +00:00
```yaml tab="File (YAML)"
2019-09-23 12:32:04 +00:00
## Static configuration
2019-07-01 09:30:05 +00:00
entryPoints:
web:
address: ":80"
2019-09-23 12:32:04 +00:00
forwardedHeaders:
2019-07-01 09:30:05 +00:00
trustedIPs:
2019-09-23 15:00:06 +00:00
- "127.0.0.1/32"
- "192.168.1.7"
2019-07-01 09:30:05 +00:00
```
2019-07-02 15:36:04 +00:00
```bash tab="CLI"
2019-09-23 12:32:04 +00:00
## Static configuration
2019-07-01 09:30:05 +00:00
--entryPoints.web.address=:80
2019-09-23 12:32:04 +00:00
--entryPoints.web.forwardedHeaders.trustedIPs=127.0.0.1/32,192.168.1.7
2019-07-01 09:30:05 +00:00
```
2019-09-23 12:32:04 +00:00
??? info "`forwardedHeaders.insecure`"
2019-09-23 12:32:04 +00:00
Insecure Mode (Always Trusting Forwarded Headers).
2019-07-01 09:30:05 +00:00
```toml tab="File (TOML)"
2019-09-23 12:32:04 +00:00
## Static configuration
[entryPoints]
[entryPoints.web]
address = ":80"
2019-09-23 12:32:04 +00:00
[entryPoints.web.forwardedHeaders]
insecure = true
```
2019-07-01 09:30:05 +00:00
```yaml tab="File (YAML)"
2019-09-23 12:32:04 +00:00
## Static configuration
2019-07-01 09:30:05 +00:00
entryPoints:
web:
address: ":80"
2019-09-23 12:32:04 +00:00
forwardedHeaders:
2019-07-01 09:30:05 +00:00
insecure: true
```
2019-07-02 15:36:04 +00:00
```bash tab="CLI"
2019-09-23 12:32:04 +00:00
## Static configuration
2019-07-01 09:30:05 +00:00
--entryPoints.web.address=:80
2019-09-23 12:32:04 +00:00
--entryPoints.web.forwardedHeaders.insecure
2019-07-01 09:30:05 +00:00
```
2019-09-23 12:32:04 +00:00
### Transport
2019-09-23 12:32:04 +00:00
#### `respondingTimeouts`
`respondingTimeouts` are timeouts for incoming requests to the Traefik instance.
??? info "`transport.respondingTimeouts.readTimeout`"
_Optional, Default=0s_
`readTimeout` is the maximum duration for reading the entire request, including the body.
If zero, no timeout exists.
Can be provided in a format supported by [time.ParseDuration](https://golang.org/pkg/time/#ParseDuration) or as raw values (digits).
If no units are provided, the value is parsed assuming seconds.
```toml tab="File (TOML)"
## Static configuration
[entryPoints]
[entryPoints.name]
address = ":8888"
[entryPoints.name.transport]
[entryPoints.name.transport.respondingTimeouts]
readTimeout = 42
```
```yaml tab="File (YAML)"
## Static configuration
entryPoints:
name:
address: ":8888"
transport:
respondingTimeouts:
readTimeout: 42
```
```bash tab="CLI"
## Static configuration
--entryPoints.name.address=:8888
--entryPoints.name.transport.respondingTimeouts.readTimeout=42
```
??? info "`transport.respondingTimeouts.writeTimeout`"
_Optional, Default=0s_
`writeTimeout` is the maximum duration before timing out writes of the response.
It covers the time from the end of the request header read to the end of the response write.
If zero, no timeout exists.
Can be provided in a format supported by [time.ParseDuration](https://golang.org/pkg/time/#ParseDuration) or as raw values (digits).
If no units are provided, the value is parsed assuming seconds.
```toml tab="File (TOML)"
## Static configuration
[entryPoints]
[entryPoints.name]
address = ":8888"
[entryPoints.name.transport]
[entryPoints.name.transport.respondingTimeouts]
writeTimeout = 42
```
```yaml tab="File (YAML)"
## Static configuration
entryPoints:
name:
address: ":8888"
transport:
respondingTimeouts:
writeTimeout: 42
```
```bash tab="CLI"
## Static configuration
--entryPoints.name.address=:8888
--entryPoints.name.transport.respondingTimeouts.writeTimeout=42
```
??? info "`transport.respondingTimeouts.idleTimeout`"
_Optional, Default=180s_
`idleTimeout` is the maximum duration an idle (keep-alive) connection will remain idle before closing itself.
If zero, no timeout exists.
Can be provided in a format supported by [time.ParseDuration](https://golang.org/pkg/time/#ParseDuration) or as raw values (digits).
If no units are provided, the value is parsed assuming seconds.
```toml tab="File (TOML)"
## Static configuration
[entryPoints]
[entryPoints.name]
address = ":8888"
[entryPoints.name.transport]
[entryPoints.name.transport.respondingTimeouts]
idleTimeout = 42
```
```yaml tab="File (YAML)"
## Static configuration
entryPoints:
name:
address: ":8888"
transport:
respondingTimeouts:
idleTimeout: 42
```
```bash tab="CLI"
## Static configuration
--entryPoints.name.address=:8888
--entryPoints.name.transport.respondingTimeouts.idleTimeout=42
```
2019-09-23 12:32:04 +00:00
#### `lifeCycle`
2019-09-23 12:32:04 +00:00
Controls the behavior of Traefik during the shutdown phase.
2019-09-23 12:32:04 +00:00
??? info "`lifeCycle.requestAcceptGraceTimeout`"
_Optional, Default=0s_
Duration to keep accepting requests prior to initiating the graceful termination period (as defined by the `graceTimeOut` option).
This option is meant to give downstream load-balancers sufficient time to take Traefik out of rotation.
Can be provided in a format supported by [time.ParseDuration](https://golang.org/pkg/time/#ParseDuration) or as raw values (digits).
If no units are provided, the value is parsed assuming seconds.
The zero duration disables the request accepting grace period, i.e., Traefik will immediately proceed to the grace period.
```toml tab="File (TOML)"
## Static configuration
[entryPoints]
[entryPoints.name]
address = ":8888"
[entryPoints.name.transport]
[entryPoints.name.transport.lifeCycle]
requestAcceptGraceTimeout = 42
```
```yaml tab="File (YAML)"
## Static configuration
entryPoints:
name:
address: ":8888"
transport:
lifeCycle:
requestAcceptGraceTimeout: 42
```
```bash tab="CLI"
## Static configuration
--entryPoints.name.address=:8888
--entryPoints.name.transport.lifeCycle.requestAcceptGraceTimeout=42
```
2019-09-23 12:32:04 +00:00
??? info "`lifeCycle.graceTimeOut`"
_Optional, Default=10s_
Duration to give active requests a chance to finish before Traefik stops.
Can be provided in a format supported by [time.ParseDuration](https://golang.org/pkg/time/#ParseDuration) or as raw values (digits).
If no units are provided, the value is parsed assuming seconds.
!!! warning "In this time frame no new requests are accepted."
2019-07-01 09:30:05 +00:00
```toml tab="File (TOML)"
2019-09-23 12:32:04 +00:00
## Static configuration
[entryPoints]
[entryPoints.name]
address = ":8888"
[entryPoints.name.transport]
[entryPoints.name.transport.lifeCycle]
graceTimeOut = 42
```
```yaml tab="File (YAML)"
## Static configuration
entryPoints:
name:
address: ":8888"
transport:
lifeCycle:
graceTimeOut: 42
```
```bash tab="CLI"
## Static configuration
--entryPoints.name.address=:8888
--entryPoints.name.transport.lifeCycle.graceTimeOut=42
```
### ProxyProtocol
Traefik supports [ProxyProtocol](https://www.haproxy.org/download/2.0/doc/proxy-protocol.txt) version 1 and 2.
If Proxy Protocol header parsing is enabled for the entry point, this entry point can accept connections with or without Proxy Protocol headers.
If the Proxy Protocol header is passed, then the version is determined automatically.
??? info "`proxyProtocol.trustedIPs`"
Enabling Proxy Protocol with Trusted IPs.
```toml tab="File (TOML)"
## Static configuration
[entryPoints]
[entryPoints.web]
address = ":80"
2019-09-23 12:32:04 +00:00
[entryPoints.web.proxyProtocol]
trustedIPs = ["127.0.0.1/32", "192.168.1.7"]
```
2019-07-01 09:30:05 +00:00
```yaml tab="File (YAML)"
2019-09-23 12:32:04 +00:00
## Static configuration
2019-07-01 09:30:05 +00:00
entryPoints:
web:
address: ":80"
2019-09-23 12:32:04 +00:00
proxyProtocol:
2019-07-01 09:30:05 +00:00
trustedIPs:
2019-09-23 15:00:06 +00:00
- "127.0.0.1/32"
- "192.168.1.7"
2019-07-01 09:30:05 +00:00
```
2019-07-02 15:36:04 +00:00
```bash tab="CLI"
2019-07-01 09:30:05 +00:00
--entryPoints.web.address=:80
2019-09-23 12:32:04 +00:00
--entryPoints.web.proxyProtocol.trustedIPs=127.0.0.1/32,192.168.1.7
2019-07-01 09:30:05 +00:00
```
2019-09-23 12:32:04 +00:00
IPs in `trustedIPs` only will lead to remote client address replacement: Declare load-balancer IPs or CIDR range here.
??? info "`proxyProtocol.insecure`"
Insecure Mode (Testing Environment Only).
In a test environments, you can configure Traefik to trust every incoming connection.
Doing so, every remote client address will be replaced (`trustedIPs` won't have any effect)
2019-07-01 09:30:05 +00:00
```toml tab="File (TOML)"
2019-09-23 12:32:04 +00:00
## Static configuration
[entryPoints]
[entryPoints.web]
address = ":80"
2019-09-23 12:32:04 +00:00
[entryPoints.web.proxyProtocol]
2019-07-01 09:30:05 +00:00
insecure = true
```
```yaml tab="File (YAML)"
2019-09-23 12:32:04 +00:00
## Static configuration
2019-07-01 09:30:05 +00:00
entryPoints:
web:
address: ":80"
2019-09-23 12:32:04 +00:00
proxyProtocol:
2019-07-01 09:30:05 +00:00
insecure: true
```
2019-07-02 15:36:04 +00:00
```bash tab="CLI"
2019-07-01 09:30:05 +00:00
--entryPoints.web.address=:80
2019-09-23 12:32:04 +00:00
--entryPoints.web.proxyProtocol.insecure
```
2019-09-23 12:32:04 +00:00
!!! warning "Queuing Traefik behind Another Load Balancer"
When queuing Traefik behind another load-balancer, make sure to configure Proxy Protocol on both sides.
Not doing so could introduce a security risk in your system (enabling request forgery).