Geo does not find current_node when behind a load balancer
Summary
If a GitLab rails/unicorn frontend machine is behind a load balancer, and the load balancer acts as https endpoint, the app doesn't recognize the node as a Geo node.
Steps to reproduce
-
Run a HAProxy, with a config somewhat like this:
frontend www-https bind 0.0.0.0:443 ssl crt /etc/ssl/cert.pem reqadd X-Forwarded-Proto:\ https default_backend www-backend backend www-backend redirect scheme https if !{ ssl_fc } server webserver01 10.132.0.6:80 check -
Run a GitLab rails/unicorn frontend machine on 10.132.0.6
-
On the frontend node, in
/etc/gitlab/gitlab.rbsetexternal_url http://my.secondary.node.geo -
On the primary, add a secondary node with the address
https://my.secondary.node.geo
What is the current bug behavior?
Gitlab::Geo.current_node does return nil.
What is the expected correct behavior?
Gitlab::Geo.current_node should return the node for the existing https host.
Possible fixes
I could place the https address in gitlab.rb on the rails/unicode machine, but then I would not listen to port 80, which HAProxy is redirecting traffic to. There might be a way to have https traffic between HAProxy and the rails/unicorn node, but that doesn't sound very efficient to me.
Related issues
gitlab-org/gitlab-ee#3646