From 028f7524b8da2aac5476d878637a9928becb6ea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20L=C3=B3pez?= Date: Sat, 13 Jun 2020 11:21:05 -0500 Subject: [PATCH] Feat: How to HTTP > HTTPS redirection with traefik [skip travis] --- docs/single-bench.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/single-bench.md b/docs/single-bench.md index 25041649..433cc1a9 100644 --- a/docs/single-bench.md +++ b/docs/single-bench.md @@ -47,6 +47,27 @@ Notes: - `AUTO_MIGRATE` variable is set to `1` by default. It checks if there is semver bump or git hash change in case of develop branch and automatically migrates the sites on container start up. - It is good practice to use image tag for specific version instead of latest. e.g `frappe-socketio:v12.5.1`, `erpnext-nginx:v12.7.1`. +### HTTP to HTTPS redirection + +> Recommended only for **production** + +If HTTPS redirection is required, add the following labels block to the **traefik** service/container. This will route any HTTP traffic to HTTPS. (e.g any request going to `http://ernext.example.com` will be redirected to `https://erpnext.example.com`) + +```yaml + # ... + labels: + # enable traefik + - "traefik.enable=true" + # global redirect to https + - "traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)" + - "traefik.http.routers.http-catchall.entrypoints=web" + - "traefik.http.routers.http-catchall.middlewares=redirect-to-https" + + # middleware redirect + - "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https" + # ... +``` + ## Start containers Execute the following command: