Skip to content

Commit db1c017

Browse files
committed
Allow HTTPS for traefik
1 parent 1210f8e commit db1c017

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ You can change the configuration of the docker images by setting various environ
131131
| `MOODLE_DOCKER_WEB_PORT` | no | any integer value | 8000 | The port number for web. If set to 0, no port is used |
132132
| `MOODLE_DOCKER_SELENIUM_VNC_PORT` | no | any integer value | not set | If set, the selenium node will expose a vnc session on the port specified |
133133
| `MOODLE_DOCKER_TRAEFIK` | no | any value | not set | If set, integrate the docker containers in traefik |
134+
| `MOODLE_DOCKER_TRAEFIK_HTTPS` | no | any value | not set | If set, use an https url in traefik |
134135

135136
## Advanced usage
136137

config.docker-template.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@
1919
}
2020
$CFG->wwwroot = "http://{$host}";
2121
$port = getenv('MOODLE_DOCKER_WEB_PORT');
22-
if (!empty($port) && empty(getenv('MOODLE_DOCKER_TRAEFIK'))) {
22+
if (!empty(getenv('MOODLE_DOCKER_TRAEFIK'))) {
23+
if (!empty(getenv('MOODLE_DOCKER_TRAEFIK_HTTPS'))) {
24+
$CFG->sslproxy = true;
25+
$CFG->wwwroot = "https://{$host}";
26+
}
27+
} else if (!empty($port)) {
2328
$CFG->wwwroot .= ":{$port}";
2429
}
2530
$CFG->dataroot = '/var/www/moodledata';

traefik.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ services:
33
webserver:
44
environment:
55
MOODLE_DOCKER_TRAEFIK: "${MOODLE_DOCKER_TRAEFIK}"
6+
MOODLE_DOCKER_TRAEFIK_HTTPS: "${MOODLE_DOCKER_TRAEFIK_HTTPS}"
67
labels:
78
- "traefik.enable=true"
89
- "traefik.frontend.rule=Host:${MOODLE_DOCKER_WEB_HOST}"

0 commit comments

Comments
 (0)