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

Fix handling of empty X_FORWARDED_HOST header. #19433

Merged

Conversation

agfor
Copy link

@agfor agfor commented Mar 20, 2015

Previously, an empty X_FORWARDED_HOST header would cause
Actiondispatch::Http:URL.raw_host_with_port to return nil, causing
Actiondispatch::Http:URL.host to raise a NoMethodError.

I ran into this bug on 3.2, so it might make sense to backport this to -stable branches.

Previously, an empty X_FORWARDED_HOST header would cause
Actiondispatch::Http:URL.raw_host_with_port to return nil, causing
Actiondispatch::Http:URL.host to raise a NoMethodError.
@rafaelfranca
Copy link
Member

Patch looks good, but why X_FORWARDED_HOST is empty in your case?

@agfor
Copy link
Author

agfor commented Mar 20, 2015

It was sent by a badly behaved client. This caused the rails app to 500 instead of redirect when attempting to handle the bad request.

rafaelfranca added a commit that referenced this pull request Mar 20, 2015
…eader

Fix handling of empty X_FORWARDED_HOST header.
@rafaelfranca rafaelfranca merged commit 37e002b into rails:master Mar 20, 2015
rafaelfranca added a commit that referenced this pull request Mar 20, 2015
…eader

Fix handling of empty X_FORWARDED_HOST header.
rafaelfranca added a commit that referenced this pull request Mar 20, 2015
…eader

Fix handling of empty X_FORWARDED_HOST header.
@rafaelfranca
Copy link
Member

Backported at 6e00fe3 and 3a4d7d8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants