HTTPS configuration of Docker4Drupal
December 19, 2019 at 12:11pmHTTPS configuration of Docker4Drupal
December 19, 2019 at 12:11pmProject traefik has configured 2 entry points: 80 and 443, defined 2 routers for http and https protocols.
Logs show that https request passed to the nginx container successfully, but debugging the php container shows that request received into container downgraded to http request.
Does anyone have some recipe or recommendations for proper https configuration?
January 23, 2020 at 7:01pm
Here's what I've set up in docker-compose.yml for apache:
image: wodby/apache:$APACHE_TAGcontainer_name: "${PROJECT_NAME}_apache"depends_on:- phpenvironment:APACHE_LOG_LEVEL: debugAPACHE_BACKEND_HOST: phpAPACHE_VHOST_PRESET: phpAPACHE_DOCUMENT_ROOT: /var/www/html/docrootvolumes:- ./:/var/www/html## For macOS users (https://wodby.com/docs/stacks/drupal/local#docker-for-mac)## - ./:/var/www/html:cached # User-guided caching## - docker-sync:/var/www/html # Docker-synclabels:- "traefik.http.routers.${PROJECT_NAME}_apache.entrypoints=web"- "traefik.http.routers.${PROJECT_NAME}_apache.rule=Host(`${PROJECT_BASE_URL}`)"- "traefik.http.middlewares.${PROJECT_NAME}_apache-https-redirect.redirectscheme.scheme=https"- "traefik.http.routers.${PROJECT_NAME}_apache.middlewares=${PROJECT_NAME}_apache-https-redirect"- "traefik.http.routers.${PROJECT_NAME}_https_apache.rule=Host(`${PROJECT_BASE_URL}`)"- "traefik.http.routers.${PROJECT_NAME}_https_apache.tls=true"- "traefik.http.routers.${PROJECT_NAME}_https_apache.entrypoints=websecure"
And for traefik:
´´´
traefik:
image: traefik:v2.0
container_name: "${PROJECT_NAME}_traefik"
command:
- --api.insecure=true- --providers.docker=true- --log.level=DEBUG- --entrypoints.web.address=:80- --entrypoints.websecure.address=:443- --configFile=traefik.tomlports:- '443:443'- '8000:80'- '8080:8080' # Dashboardvolumes:- /var/run/docker.sock:/var/run/docker.socklabels:- "traefik.http.routers.redirs.rule=Host(`${PROJECT_BASE_URL}`)"- "traefik.http.routers.redirs.entrypoints=web"- "traefik.http.routers.redirs.entrypoints=websecure"- "traefik.http.routers.redirs.middlewares=redirect-to-https"- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
´´´
The problem is that while it redirects part of the content (html for example) the css and js files still come from http. Is this something you are seeing also?