Skip to content

Commit

Permalink
Update Traefik HTTP basic auth to current (not-deprecated) configurat…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
tiangolo committed Jan 19, 2019
1 parent efcd465 commit 54adc97
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,22 +83,16 @@ export ADMIN_PASSWORD=changethis
export HASHED_PASSWORD=$(openssl passwd -apr1 $ADMIN_PASSWORD)
```

* Set and export a single variable with the username and password in "`htpasswd`" format:

```bash
export USERNAME_PASSWORD=$ADMIN_USER:$HASHED_PASSWORD
```

* You can check the contents with:

```bash
echo $USERNAME_PASSWORD
echo $HASHED_PASSWORD
```

it will look like:

```
admin:$apr1$89eqM5Ro$CxaFELthUKV21DpI3UTQO.
$apr1$89eqM5Ro$CxaFELthUKV21DpI3UTQO.
```

* Create and export an environment variable `DOMAIN`, e.g.:
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.traefik.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ services:
- traefik.redirectorservice.frontend.redirect.entryPoint=https
# Traefik service that listens to HTTPS
- traefik.webservice.frontend.entryPoints=https
- traefik.frontend.auth.basic=${USERNAME_PASSWORD}
- traefik.frontend.auth.basic.users=${ADMIN_PASSWORD}:${HASHED_PASSWORD}
networks:
- default
- net
Expand All @@ -162,7 +162,7 @@ services:
- traefik.redirectorservice.frontend.redirect.entryPoint=https
# Traefik service that listens to HTTPS
- traefik.webservice.frontend.entryPoints=https
- traefik.frontend.auth.basic=${USERNAME_PASSWORD}
- traefik.frontend.auth.basic.users=${ADMIN_PASSWORD}:${HASHED_PASSWORD}
networks:
- default
- net
Expand Down Expand Up @@ -230,7 +230,7 @@ services:
- traefik.redirectorservice.frontend.redirect.entryPoint=https
# Traefik service that listens to HTTPS
- traefik.webservice.frontend.entryPoints=https
- traefik.frontend.auth.basic=${USERNAME_PASSWORD}
- traefik.frontend.auth.basic.users=${ADMIN_PASSWORD}:${HASHED_PASSWORD}
networks:
- default
- net
Expand Down

0 comments on commit 54adc97

Please sign in to comment.