-
Notifications
You must be signed in to change notification settings - Fork 619
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
Check upstream X-Forwarded-Proto prior to redirect #466
Conversation
The AWS load balancer terminates SSL and passes plain HTTP to fabio but does not offer the ability to do a schema redirect. Therefore, fabio running behind an AWS ELB with a schema redirect rule results in a redirect loop. This PR fixes fabiolb#448.
We now generate the redirectURL in the lookup function and use it for loop detection. We also cache the redirectURL in the target for later use to prevent re-generation.
Thanks a lot! |
@@ -99,8 +99,7 @@ func (p *HTTPProxy) ServeHTTP(w http.ResponseWriter, r *http.Request) { | |||
} | |||
|
|||
if t.RedirectCode != 0 { | |||
redirectURL := t.GetRedirectURL(requestURL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@magiconair I know this already got merged but I was thinking maybe the above if
statement should be t.RedirectCode != 0 && t.RedirectURL != nil
just to be safe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. See #477
Check if the redirect url is not nil. See #466
Issue #466: make redirect code more robust
The AWS load balancer terminates SSL and passes plain HTTP
to fabio but does not offer the ability to do a schema redirect.
Therefore, fabio running behind an AWS ELB with a schema
redirect rule results in a redirect loop.
Fixes #448