Skip to content

Instantly share code, notes, and snippets.

@hairyhenderson
Last active August 28, 2016 13:49
Show Gist options
  • Save hairyhenderson/526325ba383cb458c7dead0f2f864f98 to your computer and use it in GitHub Desktop.
Save hairyhenderson/526325ba383cb458c7dead0f2f864f98 to your computer and use it in GitHub Desktop.
Why u no like redirect???
version: '2'
services:
web:
restart: always
image: emilevauge/whoami
labels:
- "traefik.port=80"
- "traefik.frontend.rule=Host:hairyhenderson.ca"
frontend:
restart: always
image: traefik
command: |-
--web
--docker --docker.domain=hairyhenderson.ca
--logLevel=DEBUG
--acme [email protected] --acme.ondemand
--acme.entrypoint=https --acme.storageFile=/certs/acme.json
--acme.domains='hairyhenderson.ca'
--entryPoints='Name:https Address::443 TLS'
--entryPoints='Name:http Address::80 Redirect.EntryPoint:https'
--defaultentrypoints='http,https'
labels:
- "traefik.enable=false"
ports:
- "80:80"
- "443:443"
- "0.0.0.0:8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /dev/null:/traefik.toml
- certStorage:/certs
volumes:
certStorage:
driver: local
@hairyhenderson
Copy link
Author

HTTPS works:

$ curl -v https://hairyhenderson.ca/      
*   Trying 159.203.50.180...
* Connected to hairyhenderson.ca (159.203.50.180) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: hairyhenderson.ca
* Server certificate: Let's Encrypt Authority X3
* Server certificate: DST Root CA X3
> GET / HTTP/1.1
> Host: hairyhenderson.ca
> User-Agent: curl/7.43.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-Length: 317
< Content-Type: text/plain; charset=utf-8
< Date: Sun, 28 Aug 2016 13:16:34 GMT
< 
Hostname: 2917efe6329e
IP: 127.0.0.1
IP: ::1
IP: 172.19.0.2
IP: fe80::42:acff:fe13:2
GET / HTTP/1.1
Host: hairyhenderson.ca
User-Agent: curl/7.43.0
Accept: */*
Accept-Encoding: gzip
X-Forwarded-For: 69.196.141.2
X-Forwarded-Host: hairyhenderson.ca
X-Forwarded-Proto: https
X-Forwarded-Server: 5acf648d27a8

* Connection #0 to host hairyhenderson.ca left intact

HTTP does not redirect:

$ curl -v http://hairyhenderson.ca/ 
*   Trying 159.203.50.180...
* Connected to hairyhenderson.ca (159.203.50.180) port 80 (#0)
> GET / HTTP/1.1
> Host: hairyhenderson.ca
> User-Agent: curl/7.43.0
> Accept: */*
> 
< HTTP/1.1 404 Not Found
< Content-Type: text/plain; charset=utf-8
< X-Content-Type-Options: nosniff
< Date: Sun, 28 Aug 2016 13:16:38 GMT
< Content-Length: 19
< 
404 page not found
* Connection #0 to host hairyhenderson.ca left intact

@hairyhenderson
Copy link
Author

Updated - works now! Just needed to add http to --defaultentrypoints

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment