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

Remote addr can support several load balancers #757

Closed
wants to merge 1 commit into from

Conversation

dLobatog
Copy link
Member

@dLobatog dLobatog commented Jul 1, 2013

Shortly after two load balancers were set up for our foreman installation, we noticed sometimes calls to /unattended/built were failing. This was due to this line of code in UnattendedController,

    if request.env['HTTP_X_FORWARDED_FOR'].present? and (ip =~ Regexp.new(Setting[:remote_addr]))
      ip = request.env['HTTP_X_FORWARDED_FOR']
    end

Since I thought :remote_addr was just an IP, this IP was set to one of the balancers. Of course in a system with several load balancers, some calls would fail. :remote_addr could be an array that contains several ips, but I believe that since it's a string used as a regexp, we can exploit this fact to support several load balancers. It works.

@skottler
Copy link

skottler commented Jul 1, 2013

Nice catch. 👍 from me.

@domcleal
Copy link
Contributor

domcleal commented Jul 5, 2013

Merged as b599ac2, thanks @elobato.

@domcleal domcleal closed this Jul 5, 2013
cfouant pushed a commit to cfouant/foreman that referenced this pull request Dec 18, 2018
…man#757)

* Update production.md docs to use a newer version in examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants