diff --git a/lib/omniauth/strategy.rb b/lib/omniauth/strategy.rb index 5f61e27..c080514 100644 --- a/lib/omniauth/strategy.rb +++ b/lib/omniauth/strategy.rb @@ -376,6 +376,8 @@ module OmniAuth uri = URI.parse(request.url.gsub(/\?.*$/,'')) uri.path = '' uri.query = nil + #sometimes the url is actually showing http inside rails because the other layers (like nginx) have handled the ssl termination. + uri.scheme = 'https' if(request.env['HTTP_X_FORWARDED_PROTO'] == 'https') uri.to_s end end