diff --git a/Gopkg.lock b/Gopkg.lock index e29cd9171..85b09e26e 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -229,8 +229,8 @@ ".", "parse" ] - revision = "963366c29a7acc2d6e02f4f9bcf260d5a1cf4968" - version = "v1.1.1" + revision = "b4c2f060875361c070ed2bc300c5929b82f5fa2e" + version = "v1.1.2" [[projects]] branch = "master" diff --git a/docs/basics.md b/docs/basics.md index bc85ae021..9a20d200e 100644 --- a/docs/basics.md +++ b/docs/basics.md @@ -234,27 +234,26 @@ The following rules are both `Matchers` and `Modifiers`, so the `Matcher` portio #### Priorities 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 [frontends] [frontends.frontend1] backend = "backend1" - priority = 10 + priority = 20 passHostHeader = true [frontends.frontend1.routes.test_1] rule = "PathPrefix:/to" [frontends.frontend2] - priority = 5 backend = "backend2" passHostHeader = true [frontends.frontend2.routes.test_1] 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 diff --git a/docs/index.md b/docs/index.md index 1f1968753..cb883342a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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`: ```yaml -version: '2' +version: '3' services: 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: ```yaml -version: '2' +version: '3' services: whoami: @@ -154,8 +154,7 @@ networks: Then, start and scale it in the `test` folder: ```shell -docker-compose up -d -docker-compose scale whoami=2 +docker-compose up --scale whoami=2 -d ``` Finally, test load-balancing between the two services `test_whoami_1` and `test_whoami_2`: diff --git a/docs/user-guide/examples.md b/docs/user-guide/examples.md index f38bbb2d1..29824a05e 100644 --- a/docs/user-guide/examples.md +++ b/docs/user-guide/examples.md @@ -155,7 +155,7 @@ This configuration allows generating a Let's Encrypt certificate (thanks to `HTT !!! note 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 That's why, it's better to use the `onHostRule` option if possible. diff --git a/examples/accessLog/traefik.ab.toml b/examples/accessLog/traefik.ab.toml index 23f8a0c05..7b0287c64 100644 --- a/examples/accessLog/traefik.ab.toml +++ b/examples/accessLog/traefik.ab.toml @@ -5,11 +5,15 @@ traefikLogsFile = "log/traefik.log" accessLogsFile = "log/access.log" logLevel = "DEBUG" +[entryPoints] + [entryPoints.api] + address = ":7888" + ################################################################ -# Web configuration backend +# API configuration ################################################################ -[web] -address = ":7888" +[api] +entryPoint = "api" ################################################################ # File configuration backend diff --git a/examples/accessLog/traefik.example.toml b/examples/accessLog/traefik.example.toml index ca3a44369..c56709f03 100644 --- a/examples/accessLog/traefik.example.toml +++ b/examples/accessLog/traefik.example.toml @@ -5,11 +5,15 @@ traefikLogsFile = "log/traefik.log" accessLogsFile = "log/access.log" logLevel = "DEBUG" +[entryPoints] + [entryPoints.api] + address = ":7888" + ################################################################ -# Web configuration backend +# API configuration ################################################################ -[web] -address = ":7888" +[api] +entryPoint = "api" ################################################################ # File configuration backend diff --git a/examples/acme/acme.toml b/examples/acme/acme.toml index fef0c9d7f..85340658d 100644 --- a/examples/acme/acme.toml +++ b/examples/acme/acme.toml @@ -11,7 +11,6 @@ defaultEntryPoints = ["http", "https"] address = ":443" [entryPoints.https.tls] - [acme] email = "test@traefik.io" storage = "/etc/traefik/conf/acme.json" @@ -19,12 +18,10 @@ entryPoint = "https" onDemand = false OnHostRule = true caServer = "http://traefik.boulder.com:4000/directory" -[acme.httpChallenge] -entryPoint="http" + [acme.httpChallenge] + entryPoint="http" - -[web] -address = ":8080" +[api] [docker] endpoint = "unix:///var/run/docker.sock" diff --git a/integration/fixtures/acme/acme_http01.toml b/integration/fixtures/acme/acme_http01.toml index 1e4f354fe..d85cc74a6 100644 --- a/integration/fixtures/acme/acme_http01.toml +++ b/integration/fixtures/acme/acme_http01.toml @@ -17,8 +17,8 @@ entryPoint = "https" onDemand = {{.OnDemand}} OnHostRule = {{.OnHostRule}} caServer = "http://{{.BoulderHost}}:4000/directory" -[acme.httpchallenge] -entrypoint="http" + [acme.httpchallenge] + entrypoint="http" [file] diff --git a/integration/fixtures/acme/acme_http01_web.toml b/integration/fixtures/acme/acme_http01_web.toml index c0633a2e2..258675a04 100644 --- a/integration/fixtures/acme/acme_http01_web.toml +++ b/integration/fixtures/acme/acme_http01_web.toml @@ -16,8 +16,8 @@ entryPoint = "https" onDemand = {{.OnDemand}} OnHostRule = {{.OnHostRule}} caServer = "http://{{.BoulderHost}}:4000/directory" -[acme.httpchallenge] -entrypoint="http" + [acme.httpchallenge] + entrypoint="http" [web] path="/traefik" diff --git a/integration/fixtures/acme/certificates.toml b/integration/fixtures/acme/certificates.toml index c0bdc831b..79d937723 100644 --- a/integration/fixtures/acme/certificates.toml +++ b/integration/fixtures/acme/certificates.toml @@ -11,6 +11,6 @@ [[tls]] entryPoints = ["https"] - [tls.certificate] - certFile = "fixtures/acme/ssl/wildcard.crt" - keyFile = "fixtures/acme/ssl/wildcard.key" \ No newline at end of file + [tls.certificate] + certFile = "fixtures/acme/ssl/wildcard.crt" + keyFile = "fixtures/acme/ssl/wildcard.key" \ No newline at end of file diff --git a/traefik.sample.toml b/traefik.sample.toml index 60eb3acd7..8385ccbc5 100644 --- a/traefik.sample.toml +++ b/traefik.sample.toml @@ -14,7 +14,7 @@ # Optional # Default: "ERROR" # -# logLevel = "ERROR" +# logLevel = "DEBUG" # Entrypoints to be used by frontends that do not specify any entrypoint. # Each frontend can specify its own entrypoints. @@ -24,6 +24,10 @@ # # defaultEntryPoints = ["http", "https"] +################################################################ +# Entrypoints configuration +################################################################ + # Entrypoints definition # # Optional @@ -32,6 +36,10 @@ [entryPoints.http] address = ":80" +################################################################ +# Traefik logs configuration +################################################################ + # Traefik logs # Enabled by default and log to stdout # @@ -54,6 +62,10 @@ # # format = "common" +################################################################ +# Access logs configuration +################################################################ + # Enable access logs # By default it will write to stdout and produce logs in the textual # Common Log Format (CLF), extended with additional fields. @@ -78,17 +90,39 @@ # format = "common" ################################################################ -# Web configuration backend +# API and dashboard configuration ################################################################ -# Enable web configuration backend -[web] +# Enable API and dashboard +[api] -# Web administration port -# -# Required -# -address = ":8080" + # Name of the related entry point + # + # Optional + # Default: "traefik" + # + # 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 diff --git a/vendor/github.com/containous/flaeg/parse/parse.go b/vendor/github.com/containous/flaeg/parse/parse.go index 4db67b10d..469c38596 100644 --- a/vendor/github.com/containous/flaeg/parse/parse.go +++ b/vendor/github.com/containous/flaeg/parse/parse.go @@ -1,6 +1,7 @@ package parse import ( + "encoding/json" "flag" "fmt" "reflect" @@ -203,6 +204,11 @@ func (d *Duration) UnmarshalText(text []byte) error { 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. func (d *Duration) UnmarshalJSON(text []byte) error { if v, err := strconv.Atoi(string(text)); err == nil { @@ -210,7 +216,13 @@ func (d *Duration) UnmarshalJSON(text []byte) error { 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) return err }