Merge branch 'v1.5' into master
This commit is contained in:
commit
526a04d4c8
12 changed files with 90 additions and 41 deletions
4
Gopkg.lock
generated
4
Gopkg.lock
generated
|
@ -229,8 +229,8 @@
|
||||||
".",
|
".",
|
||||||
"parse"
|
"parse"
|
||||||
]
|
]
|
||||||
revision = "963366c29a7acc2d6e02f4f9bcf260d5a1cf4968"
|
revision = "b4c2f060875361c070ed2bc300c5929b82f5fa2e"
|
||||||
version = "v1.1.1"
|
version = "v1.1.2"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
|
|
|
@ -234,27 +234,26 @@ The following rules are both `Matchers` and `Modifiers`, so the `Matcher` portio
|
||||||
#### Priorities
|
#### Priorities
|
||||||
|
|
||||||
By default, routes will be sorted (in descending order) using rules length (to avoid path overlap):
|
By default, routes will be sorted (in descending order) using rules length (to avoid path overlap):
|
||||||
`PathPrefix:/12345` will be matched before `PathPrefix:/1234` that will be matched before `PathPrefix:/1`.
|
`PathPrefix:/foo;Host:foo.com` (length == 28) will be matched before `PathPrefixStrip:/foobar` (length == 23) will be matched before `PathPrefix:/foo,/bar` (length == 20).
|
||||||
|
|
||||||
You can customize priority by frontend. The priority value is added to the rule length during sorting:
|
You can customize priority by frontend. The priority value override the rule length during sorting:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[frontends]
|
[frontends]
|
||||||
[frontends.frontend1]
|
[frontends.frontend1]
|
||||||
backend = "backend1"
|
backend = "backend1"
|
||||||
priority = 10
|
priority = 20
|
||||||
passHostHeader = true
|
passHostHeader = true
|
||||||
[frontends.frontend1.routes.test_1]
|
[frontends.frontend1.routes.test_1]
|
||||||
rule = "PathPrefix:/to"
|
rule = "PathPrefix:/to"
|
||||||
[frontends.frontend2]
|
[frontends.frontend2]
|
||||||
priority = 5
|
|
||||||
backend = "backend2"
|
backend = "backend2"
|
||||||
passHostHeader = true
|
passHostHeader = true
|
||||||
[frontends.frontend2.routes.test_1]
|
[frontends.frontend2.routes.test_1]
|
||||||
rule = "PathPrefix:/toto"
|
rule = "PathPrefix:/toto"
|
||||||
```
|
```
|
||||||
|
|
||||||
Here, `frontend1` will be matched before `frontend2` (`(3 + 10 == 13) > (4 + 5 == 9)`).
|
Here, `frontend1` will be matched before `frontend2` (`20 > 16`).
|
||||||
|
|
||||||
#### Custom headers
|
#### Custom headers
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ docker run -d -p 8080:8080 -p 80:80 -v $PWD/traefik.toml:/etc/traefik/traefik.to
|
||||||
You can test Træfik easily using [Docker compose](https://docs.docker.com/compose), with this `docker-compose.yml` file in a folder named `traefik`:
|
You can test Træfik easily using [Docker compose](https://docs.docker.com/compose), with this `docker-compose.yml` file in a folder named `traefik`:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
proxy:
|
proxy:
|
||||||
|
@ -134,7 +134,7 @@ In a browser, you may open [http://localhost:8080](http://localhost:8080) to acc
|
||||||
Now, create a folder named `test` and create a `docker-compose.yml` in it with this content:
|
Now, create a folder named `test` and create a `docker-compose.yml` in it with this content:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
whoami:
|
whoami:
|
||||||
|
@ -154,8 +154,7 @@ networks:
|
||||||
Then, start and scale it in the `test` folder:
|
Then, start and scale it in the `test` folder:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
docker-compose up -d
|
docker-compose up --scale whoami=2 -d
|
||||||
docker-compose scale whoami=2
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Finally, test load-balancing between the two services `test_whoami_1` and `test_whoami_2`:
|
Finally, test load-balancing between the two services `test_whoami_1` and `test_whoami_2`:
|
||||||
|
|
|
@ -155,7 +155,7 @@ This configuration allows generating a Let's Encrypt certificate (thanks to `HTT
|
||||||
!!! note
|
!!! note
|
||||||
This option simplifies the configuration but :
|
This option simplifies the configuration but :
|
||||||
|
|
||||||
* TLS handshakes will be slow when requesting a host name certificate for the first time, this can leads to DDoS attacks.
|
* TLS handshakes will be slow when requesting a hostname certificate for the first time, which can lead to DDoS attacks.
|
||||||
* Let's Encrypt have rate limiting: https://letsencrypt.org/docs/rate-limits
|
* Let's Encrypt have rate limiting: https://letsencrypt.org/docs/rate-limits
|
||||||
|
|
||||||
That's why, it's better to use the `onHostRule` option if possible.
|
That's why, it's better to use the `onHostRule` option if possible.
|
||||||
|
|
|
@ -5,11 +5,15 @@ traefikLogsFile = "log/traefik.log"
|
||||||
accessLogsFile = "log/access.log"
|
accessLogsFile = "log/access.log"
|
||||||
logLevel = "DEBUG"
|
logLevel = "DEBUG"
|
||||||
|
|
||||||
|
[entryPoints]
|
||||||
|
[entryPoints.api]
|
||||||
|
address = ":7888"
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
# Web configuration backend
|
# API configuration
|
||||||
################################################################
|
################################################################
|
||||||
[web]
|
[api]
|
||||||
address = ":7888"
|
entryPoint = "api"
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
# File configuration backend
|
# File configuration backend
|
||||||
|
|
|
@ -5,11 +5,15 @@ traefikLogsFile = "log/traefik.log"
|
||||||
accessLogsFile = "log/access.log"
|
accessLogsFile = "log/access.log"
|
||||||
logLevel = "DEBUG"
|
logLevel = "DEBUG"
|
||||||
|
|
||||||
|
[entryPoints]
|
||||||
|
[entryPoints.api]
|
||||||
|
address = ":7888"
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
# Web configuration backend
|
# API configuration
|
||||||
################################################################
|
################################################################
|
||||||
[web]
|
[api]
|
||||||
address = ":7888"
|
entryPoint = "api"
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
# File configuration backend
|
# File configuration backend
|
||||||
|
|
|
@ -11,7 +11,6 @@ defaultEntryPoints = ["http", "https"]
|
||||||
address = ":443"
|
address = ":443"
|
||||||
[entryPoints.https.tls]
|
[entryPoints.https.tls]
|
||||||
|
|
||||||
|
|
||||||
[acme]
|
[acme]
|
||||||
email = "test@traefik.io"
|
email = "test@traefik.io"
|
||||||
storage = "/etc/traefik/conf/acme.json"
|
storage = "/etc/traefik/conf/acme.json"
|
||||||
|
@ -19,12 +18,10 @@ entryPoint = "https"
|
||||||
onDemand = false
|
onDemand = false
|
||||||
OnHostRule = true
|
OnHostRule = true
|
||||||
caServer = "http://traefik.boulder.com:4000/directory"
|
caServer = "http://traefik.boulder.com:4000/directory"
|
||||||
[acme.httpChallenge]
|
[acme.httpChallenge]
|
||||||
entryPoint="http"
|
entryPoint="http"
|
||||||
|
|
||||||
|
[api]
|
||||||
[web]
|
|
||||||
address = ":8080"
|
|
||||||
|
|
||||||
[docker]
|
[docker]
|
||||||
endpoint = "unix:///var/run/docker.sock"
|
endpoint = "unix:///var/run/docker.sock"
|
||||||
|
|
|
@ -17,8 +17,8 @@ entryPoint = "https"
|
||||||
onDemand = {{.OnDemand}}
|
onDemand = {{.OnDemand}}
|
||||||
OnHostRule = {{.OnHostRule}}
|
OnHostRule = {{.OnHostRule}}
|
||||||
caServer = "http://{{.BoulderHost}}:4000/directory"
|
caServer = "http://{{.BoulderHost}}:4000/directory"
|
||||||
[acme.httpchallenge]
|
[acme.httpchallenge]
|
||||||
entrypoint="http"
|
entrypoint="http"
|
||||||
|
|
||||||
[file]
|
[file]
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@ entryPoint = "https"
|
||||||
onDemand = {{.OnDemand}}
|
onDemand = {{.OnDemand}}
|
||||||
OnHostRule = {{.OnHostRule}}
|
OnHostRule = {{.OnHostRule}}
|
||||||
caServer = "http://{{.BoulderHost}}:4000/directory"
|
caServer = "http://{{.BoulderHost}}:4000/directory"
|
||||||
[acme.httpchallenge]
|
[acme.httpchallenge]
|
||||||
entrypoint="http"
|
entrypoint="http"
|
||||||
|
|
||||||
[web]
|
[web]
|
||||||
path="/traefik"
|
path="/traefik"
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
|
|
||||||
[[tls]]
|
[[tls]]
|
||||||
entryPoints = ["https"]
|
entryPoints = ["https"]
|
||||||
[tls.certificate]
|
[tls.certificate]
|
||||||
certFile = "fixtures/acme/ssl/wildcard.crt"
|
certFile = "fixtures/acme/ssl/wildcard.crt"
|
||||||
keyFile = "fixtures/acme/ssl/wildcard.key"
|
keyFile = "fixtures/acme/ssl/wildcard.key"
|
|
@ -14,7 +14,7 @@
|
||||||
# Optional
|
# Optional
|
||||||
# Default: "ERROR"
|
# Default: "ERROR"
|
||||||
#
|
#
|
||||||
# logLevel = "ERROR"
|
# logLevel = "DEBUG"
|
||||||
|
|
||||||
# Entrypoints to be used by frontends that do not specify any entrypoint.
|
# Entrypoints to be used by frontends that do not specify any entrypoint.
|
||||||
# Each frontend can specify its own entrypoints.
|
# Each frontend can specify its own entrypoints.
|
||||||
|
@ -24,6 +24,10 @@
|
||||||
#
|
#
|
||||||
# defaultEntryPoints = ["http", "https"]
|
# defaultEntryPoints = ["http", "https"]
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# Entrypoints configuration
|
||||||
|
################################################################
|
||||||
|
|
||||||
# Entrypoints definition
|
# Entrypoints definition
|
||||||
#
|
#
|
||||||
# Optional
|
# Optional
|
||||||
|
@ -32,6 +36,10 @@
|
||||||
[entryPoints.http]
|
[entryPoints.http]
|
||||||
address = ":80"
|
address = ":80"
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# Traefik logs configuration
|
||||||
|
################################################################
|
||||||
|
|
||||||
# Traefik logs
|
# Traefik logs
|
||||||
# Enabled by default and log to stdout
|
# Enabled by default and log to stdout
|
||||||
#
|
#
|
||||||
|
@ -54,6 +62,10 @@
|
||||||
#
|
#
|
||||||
# format = "common"
|
# format = "common"
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# Access logs configuration
|
||||||
|
################################################################
|
||||||
|
|
||||||
# Enable access logs
|
# Enable access logs
|
||||||
# By default it will write to stdout and produce logs in the textual
|
# By default it will write to stdout and produce logs in the textual
|
||||||
# Common Log Format (CLF), extended with additional fields.
|
# Common Log Format (CLF), extended with additional fields.
|
||||||
|
@ -78,17 +90,39 @@
|
||||||
# format = "common"
|
# format = "common"
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
# Web configuration backend
|
# API and dashboard configuration
|
||||||
################################################################
|
################################################################
|
||||||
|
|
||||||
# Enable web configuration backend
|
# Enable API and dashboard
|
||||||
[web]
|
[api]
|
||||||
|
|
||||||
# Web administration port
|
# Name of the related entry point
|
||||||
#
|
#
|
||||||
# Required
|
# Optional
|
||||||
#
|
# Default: "traefik"
|
||||||
address = ":8080"
|
#
|
||||||
|
# entryPoint = "traefik"
|
||||||
|
|
||||||
|
# Enabled Dashboard
|
||||||
|
#
|
||||||
|
# Optional
|
||||||
|
# Default: true
|
||||||
|
#
|
||||||
|
# dashboard = false
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# Ping configuration
|
||||||
|
################################################################
|
||||||
|
|
||||||
|
# Enable ping
|
||||||
|
[ping]
|
||||||
|
|
||||||
|
# Name of the related entry point
|
||||||
|
#
|
||||||
|
# Optional
|
||||||
|
# Default: "traefik"
|
||||||
|
#
|
||||||
|
# entryPoint = "traefik"
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
# Docker configuration backend
|
# Docker configuration backend
|
||||||
|
|
14
vendor/github.com/containous/flaeg/parse/parse.go
generated
vendored
14
vendor/github.com/containous/flaeg/parse/parse.go
generated
vendored
|
@ -1,6 +1,7 @@
|
||||||
package parse
|
package parse
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
@ -203,6 +204,11 @@ func (d *Duration) UnmarshalText(text []byte) error {
|
||||||
return d.Set(string(text))
|
return d.Set(string(text))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MarshalJSON serializes the given duration value.
|
||||||
|
func (d *Duration) MarshalJSON() ([]byte, error) {
|
||||||
|
return json.Marshal(time.Duration(*d))
|
||||||
|
}
|
||||||
|
|
||||||
// UnmarshalJSON deserializes the given text into a duration value.
|
// UnmarshalJSON deserializes the given text into a duration value.
|
||||||
func (d *Duration) UnmarshalJSON(text []byte) error {
|
func (d *Duration) UnmarshalJSON(text []byte) error {
|
||||||
if v, err := strconv.Atoi(string(text)); err == nil {
|
if v, err := strconv.Atoi(string(text)); err == nil {
|
||||||
|
@ -210,7 +216,13 @@ func (d *Duration) UnmarshalJSON(text []byte) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
v, err := time.ParseDuration(string(text))
|
// We use json unmarshal on value because we have the quoted version
|
||||||
|
var value string
|
||||||
|
err := json.Unmarshal(text, &value)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
v, err := time.ParseDuration(value)
|
||||||
*d = Duration(v)
|
*d = Duration(v)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue