4

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.

1

I know its a old question but,

nano /etc/gitlab/gitlab.rb

set external_url="https://whatever"

then find right way down in the nginx area.

inside the nginx['proxy_set_headers'] = { directive add
"X-Forwarded-Ssl" => "on",

this will assume your SSL is built on a proxy further out. And url rewrite all http to https

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.