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

  1. 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
  2. Run a GitLab rails/unicorn frontend machine on 10.132.0.6

  3. On the frontend node, in /etc/gitlab/gitlab.rb set external_url http://my.secondary.node.geo

  4. 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

Assignee Loading
Time tracking Loading