2 |
3 |
404
4 | I'm sorry, nothing around here ...
5 | Go back
10 |
11 |
12 |
13 |
18 |
--------------------------------------------------------------------------------
/docs/content/reference/static-configuration/file.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Traefik File Static Configuration"
3 | description: "Reference the YAML and TOML files for static configuration in Traefik Proxy. Read the technical documentation."
4 | ---
5 |
6 | # Static Configuration: File
7 |
8 | ```yml tab="YAML"
9 | --8<-- "content/reference/static-configuration/file.yaml"
10 | ```
11 |
12 | ```toml tab="TOML"
13 | --8<-- "content/reference/static-configuration/file.toml"
14 | ```
15 |
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/ingress/fixtures/Ingress-one-rule-with-two-paths_ingress.yml:
--------------------------------------------------------------------------------
1 | kind: Ingress
2 | apiVersion: networking.k8s.io/v1beta1
3 | metadata:
4 | name: ""
5 | namespace: testing
6 |
7 | spec:
8 | rules:
9 | - http:
10 | paths:
11 | - path: /bar
12 | backend:
13 | serviceName: service1
14 | servicePort: 80
15 | - path: /foo
16 | backend:
17 | serviceName: service1
18 | servicePort: 80
19 |
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/ingress/fixtures/Ingress-with-non-matching-provider-traefik-ingressClass-and-annotation_ingress.yml:
--------------------------------------------------------------------------------
1 | kind: Ingress
2 | apiVersion: networking.k8s.io/v1beta1
3 | metadata:
4 | name: ""
5 | namespace: testing
6 | annotations:
7 | kubernetes.io/ingress.class: toto
8 |
9 | spec:
10 | rules:
11 | - http:
12 | paths:
13 | - path: /bar
14 | backend:
15 | serviceName: service1
16 | servicePort: 80
17 |
--------------------------------------------------------------------------------
/pkg/api/testdata/services-filtered-status.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "loadBalancer": {
4 | "passHostHeader": true,
5 | "servers": [
6 | {
7 | "url": "http://127.0.0.1"
8 | }
9 | ]
10 | },
11 | "name": "bar@myprovider",
12 | "provider": "myprovider",
13 | "serverStatus": {
14 | "http://127.0.0.1": "UP"
15 | },
16 | "status": "enabled",
17 | "type": "loadbalancer",
18 | "usedBy": [
19 | "foo@myprovider",
20 | "test@myprovider"
21 | ]
22 | }
23 | ]
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/ingress/fixtures/v19-Ingress-with-defaultbackend_endpoint.yml:
--------------------------------------------------------------------------------
1 | kind: Endpoints
2 | apiVersion: v1
3 | metadata:
4 | name: service1
5 | namespace: testing
6 |
7 | subsets:
8 | - addresses:
9 | - ip: 10.10.0.1
10 | ports:
11 | - port: 80
12 |
13 | ---
14 | kind: Endpoints
15 | apiVersion: v1
16 | metadata:
17 | name: defaultservice
18 | namespace: testing
19 |
20 | subsets:
21 | - addresses:
22 | - ip: 10.10.0.1
23 | ports:
24 | - port: 8080
25 |
--------------------------------------------------------------------------------
/integration/fixtures/consul_catalog/default_not_exposed.toml:
--------------------------------------------------------------------------------
1 | [global]
2 | checkNewVersion = false
3 | sendAnonymousUsage = false
4 |
5 | [log]
6 | level = "DEBUG"
7 |
8 | [entryPoints]
9 | [entryPoints.web]
10 | address = ":8000"
11 |
12 | [api]
13 | insecure = true
14 |
15 | [providers]
16 | [providers.consulCatalog]
17 | exposedByDefault = false
18 | refreshInterval = "500ms"
19 | [providers.consulCatalog.endpoint]
20 | address = "{{ .ConsulAddress }}"
21 |
--------------------------------------------------------------------------------
/integration/resources/compose/base.yml:
--------------------------------------------------------------------------------
1 | version: "3.8"
2 | services:
3 | whoami1:
4 | image: traefik/whoami
5 | labels:
6 | traefik.enable: true
7 | traefik.http.routers.router1.rule: PathPrefix(`/whoami`)
8 | traefik.http.routers.router2.rule: PathPrefix(`/whoami2`)
9 |
10 | whoami2:
11 | image: traefik/whoami
12 | labels:
13 | traefik.enable: false
14 |
15 | networks:
16 | default:
17 | name: traefik-test-network
18 | external: true
19 |
--------------------------------------------------------------------------------
/pkg/provider/acme/store.go:
--------------------------------------------------------------------------------
1 | package acme
2 |
3 | // StoredData represents the data managed by Store.
4 | type StoredData struct {
5 | Account *Account
6 | Certificates []*CertAndStore
7 | }
8 |
9 | // Store is a generic interface that represents a storage.
10 | type Store interface {
11 | GetAccount(string) (*Account, error)
12 | SaveAccount(string, *Account) error
13 | GetCertificates(string) ([]*CertAndStore, error)
14 | SaveCertificates(string, []*CertAndStore) error
15 | }
16 |
--------------------------------------------------------------------------------
/integration/fixtures/simple_hostresolver.toml:
--------------------------------------------------------------------------------
1 | [global]
2 | checkNewVersion = false
3 | sendAnonymousUsage = false
4 |
5 | [log]
6 | level = "DEBUG"
7 |
8 | [entryPoints]
9 | [entryPoints.web]
10 | address = ":8000"
11 |
12 | [api]
13 | insecure = true
14 |
15 | [providers]
16 | [providers.docker]
17 | exposedByDefault = false
18 | defaultRule = "Host(`{{ normalize .Name }}.docker.local`)"
19 | watch = true
20 |
21 | [hostResolver]
22 | cnameFlattening = true
23 |
--------------------------------------------------------------------------------
/integration/resources/compose/udp.yml:
--------------------------------------------------------------------------------
1 | version: "3.8"
2 | services:
3 | whoami-a:
4 | image: traefik/whoamiudp:latest
5 | command: -name whoami-a
6 |
7 | whoami-b:
8 | image: traefik/whoamiudp:latest
9 | command: -name whoami-b
10 |
11 | whoami-c:
12 | image: traefik/whoamiudp:latest
13 | command: -name whoami-c
14 |
15 | whoami-d:
16 | image: traefik/whoami
17 |
18 | networks:
19 | default:
20 | name: traefik-test-network
21 | external: true
22 |
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/ingress/fixtures/Ingress-with-port-name-in-backend-and-no-pod-replica_endpoint.yml:
--------------------------------------------------------------------------------
1 | kind: Endpoints
2 | apiVersion: v1
3 | metadata:
4 | name: service1
5 | namespace: testing
6 |
7 | subsets:
8 | - addresses:
9 | - ip: 10.10.0.1
10 | ports:
11 | - name: carotte
12 | port: 8090
13 | - name: tchouk
14 | port: 8089
15 | - addresses:
16 | - ip: 10.21.0.1
17 | ports:
18 | - name: carotte
19 | port: 8090
20 | - name: tchouk
21 | port: 8089
22 |
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/ingress/fixtures/Ingress-with-port-value-in-backend-and-no-pod-replica_endpoint.yml:
--------------------------------------------------------------------------------
1 | kind: Endpoints
2 | apiVersion: v1
3 | metadata:
4 | name: service1
5 | namespace: testing
6 |
7 | subsets:
8 | - addresses:
9 | - ip: 10.10.0.1
10 | ports:
11 | - name: carotte
12 | port: 8090
13 | - name: tchouk
14 | port: 8089
15 | - addresses:
16 | - ip: 10.21.0.1
17 | ports:
18 | - name: carotte
19 | port: 8090
20 | - name: tchouk
21 | port: 8089
22 |
--------------------------------------------------------------------------------
/integration/resources/compose/tracing.yml:
--------------------------------------------------------------------------------
1 | version: "3.8"
2 | services:
3 | zipkin:
4 | image: openzipkin/zipkin:2.16.2
5 | environment:
6 | STORAGE_TYPE: mem
7 | JAVA_OPTS: -Dlogging.level.zipkin=DEBUG
8 |
9 | jaeger:
10 | image: jaegertracing/all-in-one:1.14
11 | environment:
12 | COLLECTOR_ZIPKIN_HTTP_PORT: 9411
13 |
14 | whoami:
15 | image: traefik/whoami
16 |
17 | networks:
18 | default:
19 | name: traefik-test-network
20 | external: true
21 |
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/crd/fixtures/with_options.yml:
--------------------------------------------------------------------------------
1 | apiVersion: traefik.containo.us/v1alpha1
2 | kind: IngressRoute
3 | metadata:
4 | name: test.route
5 | namespace: default
6 |
7 | spec:
8 | entryPoints:
9 | - foo
10 |
11 | routes:
12 | - match: Host(`foo.com`) && PathPrefix(`/bar`)
13 | kind: Rule
14 | priority: 12
15 | services:
16 | - name: whoami
17 | port: 80
18 | passHostHeader: false
19 | responseForwarding:
20 | flushInterval: 10s
21 |
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/ingress/fixtures/Double-Single-Service-Ingress_ingress.yml:
--------------------------------------------------------------------------------
1 | kind: Ingress
2 | apiVersion: networking.k8s.io/v1beta1
3 | metadata:
4 | name: ""
5 | namespace: testing
6 |
7 | spec:
8 | backend:
9 | serviceName: service1
10 | servicePort: 80
11 |
12 | ---
13 | kind: Ingress
14 | apiVersion: networking.k8s.io/v1beta1
15 | metadata:
16 | name: ""
17 | namespace: testing
18 |
19 | spec:
20 | backend:
21 | serviceName: service2
22 | servicePort: 80
23 |
--------------------------------------------------------------------------------
/integration/fixtures/consul_catalog/connect.toml:
--------------------------------------------------------------------------------
1 | [global]
2 | checkNewVersion = false
3 | sendAnonymousUsage = false
4 |
5 | [log]
6 | level = "DEBUG"
7 |
8 | [entryPoints]
9 | [entryPoints.web]
10 | address = ":8000"
11 |
12 | [api]
13 | insecure = true
14 |
15 | [providers]
16 | [providers.consulCatalog]
17 | exposedByDefault = false
18 | refreshInterval = "500ms"
19 | connectAware = true
20 | [providers.consulCatalog.endpoint]
21 | address = "{{ .ConsulAddress }}"
22 |
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/ingress/fixtures/Ingress-with-conflicting-routers-on-path_ingress.yml:
--------------------------------------------------------------------------------
1 | kind: Ingress
2 | apiVersion: networking.k8s.io/v1beta1
3 | metadata:
4 | name: ""
5 | namespace: testing
6 |
7 | spec:
8 | rules:
9 | - http:
10 | paths:
11 | - path: /foo/bar
12 | backend:
13 | serviceName: service1
14 | servicePort: 80
15 |
16 | - path: /foo-bar
17 | backend:
18 | serviceName: service1
19 | servicePort: 80
20 |
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/ingress/fixtures/v18-Ingress-with-implementationSpecific-pathType_ingress.yml:
--------------------------------------------------------------------------------
1 | kind: Ingress
2 | apiVersion: networking.k8s.io/v1beta1
3 | metadata:
4 | name: ""
5 | namespace: testing
6 | annotations:
7 | traefik.ingress.kubernetes.io/router.pathmatcher: Path
8 | spec:
9 | rules:
10 | - http:
11 | paths:
12 | - path: /bar
13 | pathType: ImplementationSpecific
14 | backend:
15 | serviceName: service1
16 | servicePort: 80
17 |
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/ingress/fixtures/v19-Ingress-with-empty-pathType_ingress.yml:
--------------------------------------------------------------------------------
1 | kind: Ingress
2 | apiVersion: networking.k8s.io/v1
3 | metadata:
4 | name: ""
5 | namespace: testing
6 | annotations:
7 | traefik.ingress.kubernetes.io/router.pathmatcher: Path
8 | spec:
9 | rules:
10 | - http:
11 | paths:
12 | - path: /bar
13 | pathType: ""
14 | backend:
15 | service:
16 | name: service1
17 | port:
18 | number: 80
19 |
--------------------------------------------------------------------------------
/integration/resources/compose/pebble.yml:
--------------------------------------------------------------------------------
1 | version: "3.8"
2 | services:
3 | pebble:
4 | image: letsencrypt/pebble:v2.3.1
5 | command: pebble --dnsserver traefik:5053
6 | environment:
7 | # https://github.com/letsencrypt/pebble#testing-at-full-speed
8 | PEBBLE_VA_NOSLEEP: 1
9 | # https://github.com/letsencrypt/pebble#invalid-anti-replay-nonce-errors
10 | PEBBLE_WFE_NONCEREJECT: 0
11 |
12 | networks:
13 | default:
14 | name: traefik-test-network
15 | external: true
16 |
--------------------------------------------------------------------------------
/pkg/provider/file/fixtures/toml/dir01_file02.toml:
--------------------------------------------------------------------------------
1 | [http.services]
2 |
3 | [http.services.application-1.loadBalancer]
4 | [[http.services.application-1.loadBalancer.servers]]
5 | url = "http://172.17.0.1:80"
6 |
7 | [http.services.application-2.loadBalancer]
8 | [[http.services.application-2.loadBalancer.servers]]
9 | url = "http://172.17.0.2:80"
10 |
11 | [http.services.application-3.loadBalancer]
12 | [[http.services.application-3.loadBalancer.servers]]
13 | url = "http://172.17.0.3:80"
14 |
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/ingress/fixtures/Ingress-with-port-invalid-for-one-service_service.yml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: service1
5 | namespace: testing
6 |
7 | spec:
8 | ports:
9 | - name: http
10 | port: 8080
11 | protocol: TCP
12 | targetPort: http-api
13 | - name: http-admin
14 | port: 8079
15 | protocol: TCP
16 | targetPort: http-admin
17 | selector:
18 | app: foo
19 | sessionAffinity: None
20 | type: ClusterIP
21 |
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/ingress/fixtures/TLS-support_service.yml:
--------------------------------------------------------------------------------
1 | kind: Service
2 | apiVersion: v1
3 | metadata:
4 | name: example-com
5 | namespace: testing
6 |
7 | spec:
8 | ports:
9 | - name: http
10 | port: 80
11 | clusterIP: 10.0.0.1
12 | type: ClusterIP
13 |
14 | ---
15 | kind: Service
16 | apiVersion: v1
17 | metadata:
18 | name: example-org
19 | namespace: testing
20 |
21 | spec:
22 | ports:
23 | - name: http
24 | port: 80
25 | clusterIP: 10.0.0.2
26 | type: ClusterIP
27 |
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/crd/fixtures/with_two_services_weight.yml:
--------------------------------------------------------------------------------
1 | apiVersion: traefik.containo.us/v1alpha1
2 | kind: IngressRoute
3 | metadata:
4 | name: test.route
5 | namespace: default
6 |
7 | spec:
8 | entryPoints:
9 | - web
10 |
11 | routes:
12 | - match: Host(`foo.com`) && PathPrefix(`/foo`)
13 | kind: Rule
14 | priority: 12
15 | services:
16 | - name: whoami
17 | port: 80
18 | weight: 10
19 | - name: whoami2
20 | port: 8080
21 | weight: 0
22 |
23 |
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/ingress/fixtures/2-ingresses-in-different-namespace-with-same-service-name_service.yml:
--------------------------------------------------------------------------------
1 | kind: Service
2 | apiVersion: v1
3 | metadata:
4 | name: service1
5 | namespace: testing
6 |
7 | spec:
8 | ports:
9 | - name: tchouk
10 | port: 80
11 | clusterIP: 10.0.0.1
12 |
13 | ---
14 | kind: Service
15 | apiVersion: v1
16 | metadata:
17 | name: service1
18 | namespace: toto
19 |
20 | spec:
21 | ports:
22 | - name: tchouk
23 | port: 80
24 | clusterIP: 10.0.0.1
25 |
--------------------------------------------------------------------------------
/integration/fixtures/consul_catalog/connect_not_aware.toml:
--------------------------------------------------------------------------------
1 | [global]
2 | checkNewVersion = false
3 | sendAnonymousUsage = false
4 |
5 | [log]
6 | level = "DEBUG"
7 |
8 | [entryPoints]
9 | [entryPoints.web]
10 | address = ":8000"
11 |
12 | [api]
13 | insecure = true
14 |
15 | [providers]
16 | [providers.consulCatalog]
17 | exposedByDefault = false
18 | refreshInterval = "500ms"
19 | connectAware = false
20 | [providers.consulCatalog.endpoint]
21 | address = "{{ .ConsulAddress }}"
22 |
--------------------------------------------------------------------------------
/integration/fixtures/consul_catalog/simple.toml:
--------------------------------------------------------------------------------
1 | [global]
2 | checkNewVersion = false
3 | sendAnonymousUsage = false
4 |
5 | [log]
6 | level = "DEBUG"
7 |
8 | [entryPoints]
9 | [entryPoints.web]
10 | address = ":8000"
11 |
12 | [api]
13 | insecure = true
14 |
15 | [providers]
16 | [providers.consulCatalog]
17 | exposedByDefault = true
18 | refreshInterval = "500ms"
19 | defaultRule = "{{ .DefaultRule }}"
20 | [providers.consulCatalog.endpoint]
21 | address = "{{ .ConsulAddress }}"
22 |
--------------------------------------------------------------------------------
/integration/fixtures/k8s/05-ingressroutetcp.yml:
--------------------------------------------------------------------------------
1 | apiVersion: traefik.containo.us/v1alpha1
2 | kind: IngressRouteTCP
3 | metadata:
4 | name: test3.route
5 | namespace: default
6 |
7 | spec:
8 | entryPoints:
9 | - footcp
10 | routes:
11 | - match: HostSNI(`*`)
12 | services:
13 | - name: whoamitcp
14 | namespace: default
15 | port: 8080
16 | - name: externalname-svc
17 | port: 9090
18 | tls:
19 | options:
20 | name: mytlsoption
21 | store:
22 | name: mytlsstore
23 |
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/ingress/fixtures/Ingress-one-rule-with-one-host-and-two-paths_ingress.yml:
--------------------------------------------------------------------------------
1 | kind: Ingress
2 | apiVersion: networking.k8s.io/v1beta1
3 | metadata:
4 | name: ""
5 | namespace: testing
6 |
7 | spec:
8 | rules:
9 | - host: traefik.tchouk
10 | http:
11 | paths:
12 | - path: /bar
13 | backend:
14 | serviceName: service1
15 | servicePort: 80
16 | - path: /foo
17 | backend:
18 | serviceName: service1
19 | servicePort: 80
20 |
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/ingress/fixtures/Ingress-with-IPv6-endpoints_ingress.yml:
--------------------------------------------------------------------------------
1 | kind: Ingress
2 | apiVersion: networking.k8s.io/v1beta1
3 | metadata:
4 | name: example.com
5 | namespace: testing
6 |
7 | spec:
8 | rules:
9 | - http:
10 | paths:
11 | - path: /bar
12 | backend:
13 | serviceName: service-bar
14 | servicePort: 8080
15 | - path: /foo
16 | backend:
17 | serviceName: service-foo
18 | servicePort: 8080
19 |
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/ingress/fixtures/Ingress-with-a-named-port-matching-subset-of-service-pods_endpoint.yml:
--------------------------------------------------------------------------------
1 | kind: Endpoints
2 | apiVersion: v1
3 | metadata:
4 | name: service1
5 | namespace: testing
6 |
7 | subsets:
8 | - addresses:
9 | - ip: 10.10.0.1
10 | - ip: 10.10.0.2
11 | ports:
12 | - name: tchouk
13 | port: 8089
14 | - addresses:
15 | - ip: 10.10.0.1
16 | - ip: 10.10.0.2
17 | - ip: 10.10.0.3
18 | ports:
19 | - name: carotte
20 | port: 8090
21 |
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/ingress/fixtures/Ingress-with-two-different-rules-with-one-path_ingress.yml:
--------------------------------------------------------------------------------
1 | kind: Ingress
2 | apiVersion: networking.k8s.io/v1beta1
3 | metadata:
4 | name: ""
5 | namespace: testing
6 |
7 | spec:
8 | rules:
9 | - http:
10 | paths:
11 | - path: /bar
12 | backend:
13 | serviceName: service1
14 | servicePort: 80
15 | - http:
16 | paths:
17 | - path: /foo
18 | backend:
19 | serviceName: service1
20 | servicePort: 80
21 |
--------------------------------------------------------------------------------
/integration/fixtures/acme/certificates.toml:
--------------------------------------------------------------------------------
1 | [http.services]
2 | [http.services.test.loadBalancer]
3 | [[http.services.test.loadBalancer.servers]]
4 | url = "http://127.0.0.1:9010"
5 |
6 | [http.routers]
7 | [http.routers.test]
8 | entryPoints = ["websecure"]
9 | rule = "Host(`traefik.acme.wtf`)"
10 | service = "test"
11 | [http.routers.test.tls]
12 |
13 | [[tls.certificates]]
14 | stores = ["default"]
15 | certFile = "fixtures/acme/ssl/wildcard.crt"
16 | keyFile = "fixtures/acme/ssl/wildcard.key"
17 |
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/crd/fixtures/with_plugin_read_array_of_secret.yml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Secret
3 | metadata:
4 | name: name
5 | namespace: default
6 |
7 | data:
8 | key1: c2VjcmV0X2RhdGEx
9 | key2: c2VjcmV0X2RhdGEy
10 |
11 | ---
12 | apiVersion: traefik.containo.us/v1alpha1
13 | kind: Middleware
14 | metadata:
15 | name: test-secret
16 | namespace: default
17 |
18 | spec:
19 | plugin:
20 | test-secret:
21 | secret:
22 | - urn:k8s:secret:name:key1
23 | - urn:k8s:secret:name:key2
24 |
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/ingress/fixtures/v19-Ingress-with-implementationSpecific-pathType_ingress.yml:
--------------------------------------------------------------------------------
1 | kind: Ingress
2 | apiVersion: networking.k8s.io/v1
3 | metadata:
4 | name: ""
5 | namespace: testing
6 | annotations:
7 | traefik.ingress.kubernetes.io/router.pathmatcher: Path
8 | spec:
9 | rules:
10 | - http:
11 | paths:
12 | - path: /bar
13 | pathType: ImplementationSpecific
14 | backend:
15 | service:
16 | name: service1
17 | port:
18 | number: 80
--------------------------------------------------------------------------------
/pkg/tls/version.go:
--------------------------------------------------------------------------------
1 | package tls
2 |
3 | import "crypto/tls"
4 |
5 | // GetVersion returns the normalized TLS version.
6 | // Available TLS versions defined at https://pkg.go.dev/crypto/tls/#pkg-constants
7 | func GetVersion(connState *tls.ConnectionState) string {
8 | switch connState.Version {
9 | case tls.VersionTLS10:
10 | return "1.0"
11 | case tls.VersionTLS11:
12 | return "1.1"
13 | case tls.VersionTLS12:
14 | return "1.2"
15 | case tls.VersionTLS13:
16 | return "1.3"
17 | }
18 |
19 | return "unknown"
20 | }
21 |
--------------------------------------------------------------------------------
/integration/fixtures/k8s/03-ingressroute.yml:
--------------------------------------------------------------------------------
1 | apiVersion: traefik.containo.us/v1alpha1
2 | kind: IngressRoute
3 | metadata:
4 | name: test.route
5 | namespace: default
6 | labels:
7 | app: traefik
8 |
9 | spec:
10 | entryPoints:
11 | - web
12 |
13 | routes:
14 | - match: Host(`foo.com`) && PathPrefix(`/bar`)
15 | kind: Rule
16 | priority: 12
17 | services:
18 | - name: whoami
19 | port: 80
20 |
21 | tls:
22 | options:
23 | name: mytlsoption
24 | store:
25 | name: mytlsstore
26 |
--------------------------------------------------------------------------------
/pkg/provider/rancher/label.go:
--------------------------------------------------------------------------------
1 | package rancher
2 |
3 | import (
4 | "github.com/traefik/traefik/v2/pkg/config/label"
5 | )
6 |
7 | type configuration struct {
8 | Enable bool
9 | }
10 |
11 | func (p *Provider) getConfiguration(service rancherData) (configuration, error) {
12 | conf := configuration{
13 | Enable: p.ExposedByDefault,
14 | }
15 |
16 | err := label.Decode(service.Labels, &conf, "traefik.rancher.", "traefik.enable")
17 | if err != nil {
18 | return configuration{}, err
19 | }
20 |
21 | return conf, nil
22 | }
23 |
--------------------------------------------------------------------------------
/pkg/collector/collector_test.go:
--------------------------------------------------------------------------------
1 | package collector
2 |
3 | import (
4 | "testing"
5 |
6 | "github.com/stretchr/testify/assert"
7 | "github.com/stretchr/testify/require"
8 | "github.com/traefik/traefik/v2/pkg/config/static"
9 | )
10 |
11 | func Test_createBody(t *testing.T) {
12 | var staticConfiguration static.Configuration
13 |
14 | err := hydrate(&staticConfiguration)
15 | require.NoError(t, err)
16 |
17 | buffer, err := createBody(&staticConfiguration)
18 | require.NoError(t, err)
19 |
20 | assert.NotEmpty(t, buffer)
21 | }
22 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 | contact_links:
3 | - name: Traefik Community Support
4 | url: https://community.traefik.io/
5 | about: If you have a question, or are looking for advice, please post on our Discuss forum! The community loves to chime in to help. Happy Coding!
6 | - name: Traefik Helm Chart Issues
7 | url: https://github.com/traefik/traefik-helm-chart
8 | about: Are you submitting an issue or feature enhancement for the Traefik helm chart? Please post in the traefik-helm-chart GitHub Issues.
9 |
--------------------------------------------------------------------------------
/integration/fixtures/consul_catalog/connect_by_default.toml:
--------------------------------------------------------------------------------
1 | [global]
2 | checkNewVersion = false
3 | sendAnonymousUsage = false
4 |
5 | [log]
6 | level = "DEBUG"
7 |
8 | [entryPoints]
9 | [entryPoints.web]
10 | address = ":8000"
11 |
12 | [api]
13 | insecure = true
14 |
15 | [providers]
16 | [providers.consulCatalog]
17 | exposedByDefault = false
18 | refreshInterval = "500ms"
19 | connectAware = true
20 | connectByDefault = true
21 | [providers.consulCatalog.endpoint]
22 | address = "{{ .ConsulAddress }}"
23 |
--------------------------------------------------------------------------------
/integration/fixtures/consul_catalog/simple_watch.toml:
--------------------------------------------------------------------------------
1 | [global]
2 | checkNewVersion = false
3 | sendAnonymousUsage = false
4 |
5 | [log]
6 | level = "DEBUG"
7 |
8 | [entryPoints]
9 | [entryPoints.web]
10 | address = ":8000"
11 |
12 | [api]
13 | insecure = true
14 |
15 | [providers]
16 | [providers.consulCatalog]
17 | exposedByDefault = true
18 | refreshInterval = "500ms"
19 | defaultRule = "{{ .DefaultRule }}"
20 | watch = true
21 | [providers.consulCatalog.endpoint]
22 | address = "{{ .ConsulAddress }}"
23 |
--------------------------------------------------------------------------------
/integration/fixtures/traefik_log_config.toml:
--------------------------------------------------------------------------------
1 | [global]
2 | checkNewVersion = false
3 | sendAnonymousUsage = false
4 |
5 | [log]
6 | level = "DEBUG"
7 | filePath = "traefik.log"
8 |
9 | [accessLog]
10 | filePath = "access.log"
11 |
12 | [entryPoints]
13 | [entryPoints.web]
14 | address = ":8000"
15 |
16 | [api]
17 | insecure = true
18 | dashboard = false
19 |
20 | [providers]
21 | [providers.docker]
22 | exposedByDefault = false
23 | defaultRule = "Host(`{{ normalize .Name }}.docker.local`)"
24 | watch = true
25 |
--------------------------------------------------------------------------------
/docs/content/reference/dynamic-configuration/ecs.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Traefik AWS ECS Configuration Documentation"
3 | description: "Learn how to do dynamic configuration in Traefik Proxy with AWS ECS. Read the technical documentation."
4 | ---
5 |
6 | # ECS Configuration Reference
7 |
8 | Dynamic configuration with ECS provider
9 | {: .subtitle }
10 |
11 | The labels are case insensitive.
12 |
13 | ```yaml
14 | --8<-- "content/reference/dynamic-configuration/ecs.yml"
15 | --8<-- "content/reference/dynamic-configuration/docker-labels.yml"
16 | ```
17 |
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/ingress/fixtures/Ingress-with-two-paths-using-same-service-and-different-port-name_ingress.yml:
--------------------------------------------------------------------------------
1 | kind: Ingress
2 | apiVersion: networking.k8s.io/v1beta1
3 | metadata:
4 | name: ""
5 | namespace: testing
6 |
7 | spec:
8 | rules:
9 | - host: traefik.tchouk
10 | http:
11 | paths:
12 | - path: /bar
13 | backend:
14 | serviceName: service1
15 | servicePort: tchouk
16 | - path: /foo
17 | backend:
18 | serviceName: service1
19 | servicePort: carotte
20 |
--------------------------------------------------------------------------------
/pkg/server/service/bufferpool.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import "sync"
4 |
5 | const bufferPoolSize = 32 * 1024
6 |
7 | func newBufferPool() *bufferPool {
8 | return &bufferPool{
9 | pool: sync.Pool{
10 | New: func() interface{} {
11 | return make([]byte, bufferPoolSize)
12 | },
13 | },
14 | }
15 | }
16 |
17 | type bufferPool struct {
18 | pool sync.Pool
19 | }
20 |
21 | func (b *bufferPool) Get() []byte {
22 | return b.pool.Get().([]byte)
23 | }
24 |
25 | func (b *bufferPool) Put(bytes []byte) {
26 | b.pool.Put(bytes)
27 | }
28 |
--------------------------------------------------------------------------------
/integration/fixtures/simple_secure_api.toml:
--------------------------------------------------------------------------------
1 | [global]
2 | checkNewVersion = false
3 | sendAnonymousUsage = false
4 |
5 | [entryPoints]
6 | [entryPoints.web]
7 | address = ":8000"
8 |
9 | [entryPoints.traefik]
10 | address = ":8080"
11 |
12 |
13 | [api]
14 |
15 | [providers.file]
16 | filename = "{{ .SelfFilename }}"
17 |
18 | [http.routers.api]
19 | rule="PathPrefix(`/secure`)"
20 | service="api@internal"
21 | middlewares=["strip"]
22 |
23 | [http.middlewares.strip.stripPrefix]
24 | prefixes = [ "/secure" ]
25 |
26 |
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/crd/fixtures/with_two_rules.yml:
--------------------------------------------------------------------------------
1 | apiVersion: traefik.containo.us/v1alpha1
2 | kind: IngressRoute
3 | metadata:
4 | name: test.route
5 | namespace: default
6 |
7 | spec:
8 | entryPoints:
9 | - web
10 |
11 | routes:
12 | - match: Host(`foo.com`) && PathPrefix(`/foo`)
13 | kind: Rule
14 | priority: 12
15 | services:
16 | - name: whoami
17 | port: 80
18 | - match: Host(`foo.com`) && PathPrefix(`/bar`)
19 | kind: Rule
20 | priority: 14
21 | services:
22 | - name: whoami
23 | port: 80
24 |
--------------------------------------------------------------------------------
/docs/content/reference/dynamic-configuration/file.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Traefik File Dynamic Configuration"
3 | description: "This guide will provide you with the YAML and TOML files for dynamic configuration in Traefik Proxy. Read the technical documentation."
4 | ---
5 |
6 | # File Configuration Reference
7 |
8 | Dynamic configuration with files
9 | {: .subtitle }
10 |
11 | ```yml tab="YAML"
12 | --8<-- "content/reference/dynamic-configuration/file.yaml"
13 | ```
14 |
15 | ```toml tab="TOML"
16 | --8<-- "content/reference/dynamic-configuration/file.toml"
17 | ```
18 |
--------------------------------------------------------------------------------
/docs/content/user-guides/crd-acme/05-tlsoption.yml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: traefik.containo.us/v1alpha1
3 | kind: TLSOption
4 | metadata:
5 | name: default
6 | namespace: default
7 | spec:
8 | minVersion: VersionTLS12
9 | cipherSuites:
10 | - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 # TLS 1.2
11 | - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 # TLS 1.2
12 | - TLS_AES_256_GCM_SHA384 # TLS 1.3
13 | - TLS_CHACHA20_POLY1305_SHA256 # TLS 1.3
14 | curvePreferences:
15 | - CurveP521
16 | - CurveP384
17 | sniStrict: true
18 |
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/crd/fixtures/with_plugin_deep_read_secret.yml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Secret
3 | metadata:
4 | name: name
5 | namespace: default
6 |
7 | data:
8 | key: dGhpc19pc190aGVfdmVyeV9kZWVwX3NlY3JldA==
9 |
10 | ---
11 | apiVersion: traefik.containo.us/v1alpha1
12 | kind: Middleware
13 | metadata:
14 | name: test-secret
15 | namespace: default
16 |
17 | spec:
18 | plugin:
19 | test-secret:
20 | secret_0:
21 | secret_1:
22 | secret_2:
23 | user: admin
24 | secret: urn:k8s:secret:name:key
25 |
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/ingress/fixtures/Ingress-with-conflicting-routers-on-host_ingress.yml:
--------------------------------------------------------------------------------
1 | kind: Ingress
2 | apiVersion: networking.k8s.io/v1beta1
3 | metadata:
4 | name: ""
5 | namespace: testing
6 |
7 | spec:
8 | rules:
9 | - host: "*.bar"
10 | http:
11 | paths:
12 | - path: /bar
13 | backend:
14 | serviceName: service1
15 | servicePort: 80
16 |
17 | - host: "bar"
18 | http:
19 | paths:
20 | - path: /bar
21 | backend:
22 | serviceName: service1
23 | servicePort: 80
24 |
--------------------------------------------------------------------------------
/pkg/api/testdata/middlewares-filtered-search.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "addPrefix": {
4 | "prefix": "/toto"
5 | },
6 | "name": "addPrefixTest@anotherprovider",
7 | "provider": "anotherprovider",
8 | "status": "enabled",
9 | "type": "addprefix",
10 | "usedBy": [
11 | "bar@myprovider"
12 | ]
13 | },
14 | {
15 | "addPrefix": {
16 | "prefix": "/titi"
17 | },
18 | "name": "addPrefixTest@myprovider",
19 | "provider": "myprovider",
20 | "status": "disabled",
21 | "type": "addprefix",
22 | "usedBy": [
23 | "test@myprovider"
24 | ]
25 | }
26 | ]
--------------------------------------------------------------------------------
/pkg/provider/kubernetes/ingress/fixtures/Ingress-with-two-services_ingress.yml:
--------------------------------------------------------------------------------
1 | kind: Ingress
2 | apiVersion: networking.k8s.io/v1beta1
3 | metadata:
4 | name: ""
5 | namespace: testing
6 |
7 | spec:
8 | rules:
9 | - host: traefik.tchouk
10 | http:
11 | paths:
12 | - path: /bar
13 | backend:
14 | serviceName: service1
15 | servicePort: 80
16 | - host: traefik.courgette
17 | http:
18 | paths:
19 | - path: /carotte
20 | backend:
21 | serviceName: service2
22 | servicePort: 8082
23 |
--------------------------------------------------------------------------------
/pkg/provider/nomad/tag.go:
--------------------------------------------------------------------------------
1 | package nomad
2 |
3 | import (
4 | "strings"
5 | )
6 |
7 | func tagsToLabels(tags []string, prefix string) map[string]string {
8 | labels := make(map[string]string, len(tags))
9 | for _, tag := range tags {
10 | if strings.HasPrefix(tag, prefix) {
11 | if parts := strings.SplitN(tag, "=", 2); len(parts) == 2 {
12 | left, right := strings.TrimSpace(parts[0]), strings.TrimSpace(parts[1])
13 | key := "traefik." + strings.TrimPrefix(left, prefix+".")
14 | labels[key] = right
15 | }
16 | }
17 | }
18 | return labels
19 | }
20 |
--------------------------------------------------------------------------------
/webui/src/components/_commons/TLSState.vue:
--------------------------------------------------------------------------------
1 |