Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gitlab behind reverse proxy generates ERR_TOO_MANY_REDIRECTS #1372

Open
cszawisza opened this issue Oct 8, 2017 · 3 comments
Open

gitlab behind reverse proxy generates ERR_TOO_MANY_REDIRECTS #1372

cszawisza opened this issue Oct 8, 2017 · 3 comments
Labels

Comments

@cszawisza
Copy link

Hi!

What I'm Trying to achieve

Deploy gitlab using reverse proxy based on sameersbn/nginx:1.10.3 with SSL support. Or in other words, force gitlab to work on https://gitlab.site.com insted of site.com:10080

My current configuration

docker run
docker info
nginx config for gitlab
i removed the 'spdy' protocol from configuration due to some warnings after config reload in nginx

My docker configuration is based on Using https with load balancer
Nginx config for gitlab subdomain was based on #723

What is wrong

After starting containers, every connection ends up with an redirect loop error...
wget response to http://gitlab.site.com
the same error appears if I try to connect to gitlab using direct IP address (http://<server_ip>:10080)

I don't know what sort of information may be useful at the moment, so please tell me what else can I paste.

@tomastzn
Copy link
Contributor

tomastzn commented Nov 4, 2017

I have a similar setup.

The difference is that I run the reverse proxy(nginx) on one host(192.168.32.32), not in docker, and gitlab in docker on another host(192.168.33.33).
Also, my setup exposes gitlab on relative path /gitlab, with HTTPs on non-standard port.

Here is the part of the nginx configuration:

upstream gitlabserver {
	server 192.168.33.33:10080;
}

server {
        listen 44444 ssl default_server;
        server_name *****;

        # SSL certificate, key, protocols and ciphers here

        underscores_in_headers on;

	location /gitlab/ {
		proxy_set_header X-Forwarded-Ssl on;
		proxy_set_header X-Forwarded-Host $host;
                proxy_set_header X-Forwarded-Server $host;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

                proxy_pass http://gitlabserver;
		proxy_redirect https://$host/ https://$host:$server_port/;

                client_max_body_size 10M;
                proxy_buffer_size 8k;
                gzip off;
	}
}

Note: Since I use non-standard port, the proxy_redirect directive tells the nginx to rewrite redirects so they don't loose the port.

And here are the environment variables for docker running gitlab:

# Host where gitlab is exposed, ports and relative root
GITLAB_HTTPS=true
GITLAB_HOST=********
GITLAB_TRUSTED_PROXIES=192.168.32.32
GITLAB_SSH_PORT=10022
GITLAB_PORT=44444
GITLAB_RELATIVE_URL_ROOT=/gitlab
NGINX_REAL_IP_RECURSIVE=on
NGINX_REAL_IP_TRUSTED_ADDRESSES=192.168.32.32

Hopefully this will help you resolve the issue.

@cszawisza
Copy link
Author

Hi!

Funny thing is that... It started to work after I clean my data directory and start a fresh copy of gitlab

@stale
Copy link

stale bot commented May 7, 2020

This issue has been automatically marked as stale because it has not had any activity for the last 60 days. It will be closed if no further activity occurs during the next 7 days. Thank you for your contributions.

@stale stale bot added the wontfix label May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants