Skip to content

Instantly share code, notes, and snippets.

@plombardi89
Created August 5, 2016 17:06
Show Gist options
  • Save plombardi89/c3a67f5b38844d84b66494099059c985 to your computer and use it in GitHub Desktop.
Save plombardi89/c3a67f5b38844d84b66494099059c985 to your computer and use it in GitHub Desktop.
Traefik Stuff
# rules.toml
################################################################
# Traefik Rules Configuration
################################################################
[frontends]
[frontends.foo]
passHostHeader = true
backend = "foo"
rule = "PathPrefixStrip: /foo"
# [frontends.bar]
# backend = "bar"
# rule = "PathPrefix:/bar"
[backends]
[backends.foo]
[backends.foo.LoadBalancer]
method = "drr"
[backends.foo.servers.server1]
url = "http://127.0.0.1:5000"
# [backends.bar]
# [backends.bar.servers.server1]
# url = "http://127.0.0.1:5100"
---
DEBUG LOGS
---
[plombardi@plombardi-lt0 apigw]$ traefik -c traefik.toml -d
INFO[2016-08-05T13:03:30-04:00] Traefik version v1.0.2 built on 2016-08-02_05:35:02PM
INFO[2016-08-05T13:03:30-04:00] Using TOML configuration file /home/plombardi/work/datawire/xp/apigw/traefik.toml
DEBU[2016-08-05T13:03:30-04:00] Global configuration loaded {"GraceTimeOut":10,"Debug":true,"AccessLogsFile":"log/access.log","TraefikLogsFile":"","LogLevel":"DEBUG","EntryPoints":{"http":{"Network":"","Address":":9000","TLS":null,"Redirect":null}},"Constraints":[],"ACME":null,"DefaultEntryPoints":["http"],"ProvidersThrottleDuration":2000000000,"MaxIdleConnsPerHost":200,"Retry":null,"Docker":null,"File":{"Watch":true,"Filename":"rules.toml","Constraints":null},"Web":{"Address":":7888","CertFile":"","KeyFile":"","ReadOnly":false},"Marathon":null,"Consul":null,"ConsulCatalog":null,"Etcd":null,"Zookeeper":null,"Boltdb":null,"Kubernetes":null}
INFO[2016-08-05T13:03:30-04:00] Preparing server http &{Network: Address::9000 TLS:<nil> Redirect:<nil>}
INFO[2016-08-05T13:03:30-04:00] Starting provider *provider.File {"Watch":true,"Filename":"rules.toml","Constraints":null}
INFO[2016-08-05T13:03:30-04:00] Starting provider *main.WebProvider {"Address":":7888","CertFile":"","KeyFile":"","ReadOnly":false}
INFO[2016-08-05T13:03:30-04:00] Starting server on :9000
DEBU[2016-08-05T13:03:30-04:00] Configuration received from provider file: {"backends":{"foo":{"servers":{"server1":{"url":"http://127.0.0.1:5000","weight":0}},"loadBalancer":{"method":"drr"}}},"frontends":{"foo":{"entryPoints":["http"],"backend":"foo","passHostHeader":true,"priority":0}}}
DEBU[2016-08-05T13:03:30-04:00] Last file config received more than 2s, OK
DEBU[2016-08-05T13:03:30-04:00] Creating frontend foo
DEBU[2016-08-05T13:03:30-04:00] Wiring frontend foo to entryPoint http
DEBU[2016-08-05T13:03:30-04:00] Creating backend foo
DEBU[2016-08-05T13:03:30-04:00] Creating load-balancer drr
DEBU[2016-08-05T13:03:30-04:00] Creating server server1 at http://127.0.0.1:5000 with weight 0
INFO[2016-08-05T13:03:30-04:00] Server configuration reloaded on :9000
DEBU[2016-08-05T13:03:51-04:00] Round trip: http://127.0.0.1:5000, code: 404, duration: 1.578608ms
---
Access Logs
---
127.0.0.1 - - [05/Aug/2016:13:03:51 -0400] "GET /foo/hello/baz HTTP/1.1" 404 233 "" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36" 1 "foo" "http://127.0.0.1:5000" 1.787202ms
127.0.0.1 - - [05/Aug/2016:13:05:03 -0400] "GET //hello/baz HTTP/1.1" 301 0 "" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36" 2 "" "" 37.167µs
127.0.0.1 - - [05/Aug/2016:13:05:03 -0400] "GET /hello/baz HTTP/1.1" 200 78 "" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36" 3 "foo" "http://127.0.0.1:5000" 2.335628ms
127.0.0.1 - - [05/Aug/2016:13:05:12 -0400] "GET /foo/hello/baz HTTP/1.1" 404 233 "" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36" 4 "foo" "http://127.0.0.1:5000" 4.3086ms
127.0.0.1 - - [05/Aug/2016:13:06:05 -0400] "GET /hello/baz HTTP/1.1" 200 78 "" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36" 5 "foo" "http://127.0.0.1:5000" 1.229724ms
127.0.0.1 - - [05/Aug/2016:13:06:11 -0400] "GET /foo/hello/baz HTTP/1.1" 404 233 "" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36" 6 "foo" "http://127.0.0.1:5000" 2.026687ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment