I have GitLab’s nginx setup to listen at 127.0.0.1:8088 . Then I have a system nginx (installed via apt-get on Ubuntu) setup as reverse proxy with HTTPS:
upstream gitlab {
server localhost:8088 fail_timeout=0;
}
server {
listen 80;
server_name gitlab.myhost.com;
return 301 https://$server_name$request_uri;
}
# let gitlab deal with the redirection
server {
listen 443 ssl;
server_name gitlab.myhost.com;
ssl_certificate /srv/www/gitlab.myhost.com.unified.crt;
ssl_certificate_key /srv/www/gitlab.myhost.com.key;
location / {
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_pass http://gitlab;
}
}
This worked okay, and basically all requests are forwarded to HTTPS. However, because GitLab still thinks it’s running in HTTP, a few graphics resources on the page, and Gravatar are using HTTP scheme. How do I solve this problem?
Of course I understand that I can configure gitlab.rb
to use an HTTPS URL. However when this is done, GitLab will start asking for certificates to setup its own nginx. I really only need its own nginx to run in HTTP, at local loopback.