-
- Downloads
Fix health checks not working behind load balancers
The change in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24199 caused requests coming from a load balancer to arrive as 127.0.0.1 instead of the actual IP. `Rack::Request#ip` behaves slightly differently different than `ActionDispatch::Request#remote_ip`: the former will return the first X-Forwarded-For IP if all of the IPs are trusted proxies, while the second one filters out all proxies and falls back to REMOTE_ADDR, which is 127.0.0.1. For now, we can revert back to using `Rack::Request` because these middlewares don't manipulate parameters. The actual fix problem involves fixing Rails: https://github.com/rails/rails/issues/28436. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/58573
Showing
- changelogs/unreleased/sh-revert-rack-request-health-checks.yml 5 additions, 0 deletions...elogs/unreleased/sh-revert-rack-request-health-checks.yml
- lib/gitlab/middleware/basic_health_check.rb 7 additions, 1 deletionlib/gitlab/middleware/basic_health_check.rb
- lib/gitlab/request_context.rb 7 additions, 1 deletionlib/gitlab/request_context.rb
- spec/lib/gitlab/middleware/basic_health_check_spec.rb 29 additions, 0 deletionsspec/lib/gitlab/middleware/basic_health_check_spec.rb
- spec/lib/gitlab/request_context_spec.rb 26 additions, 1 deletionspec/lib/gitlab/request_context_spec.rb
Please register or sign in to comment