HTTP to HTTPS redirection with Docker Compose

Hello,
I have just installed GitLab with Docker.

Now I want to do an http to https redirection, e.g. I would redirect: http://localhost to https://localhost

I have tried with:
nginx[‘redirect_http_to_https’] = true
accordingly to:
https://docs.gitlab.com/omnibus/settings/nginx.html
but without luck.

This is my docker-compose:
web:
image: ‘gitlab/gitlab-ce:latest’
container_name: ‘gitlab-smn’
restart: always
hostname: ‘gitlab.smn.com
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url ‘https://gitlab.smn.com
nginx[‘redirect_http_to_https’] = true
ports:
- ‘443:443’
- ‘80:80’
volumes:
- ‘/srv/gitlab/config:/etc/gitlab’
- ‘/srv/gitlab/logs:/var/log/gitlab’
- ‘/srv/gitlab/data:/var/opt/gitlab’

Can anyone give me some hint?
Thanks and regards
Giuseppe

Hi,

the container’s VHost doesn’t identify itself as localhost which is likely why the redirect doesn’t take place. Did you try the external domain with http instead https? With that it should work.

Cheers,
Michael