mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 03:24:33 +08:00
FIX: do not follow redirect on same host with path /login or /session
This commit is contained in:
@ -229,10 +229,16 @@ class FinalDestination
|
||||
end
|
||||
|
||||
if location
|
||||
redirect_uri = uri(location)
|
||||
if @uri.host == redirect_uri.host && (redirect_uri.path =~ /\/login/ || redirect_uri.path =~ /\/session/)
|
||||
@status = :resolved
|
||||
return @uri
|
||||
end
|
||||
|
||||
old_port = @uri.port
|
||||
location = "#{location}##{@uri.fragment}" if @preserve_fragment_url && @uri.fragment.present?
|
||||
location = "#{@uri.scheme}://#{@uri.host}#{location}" if location[0] == "/"
|
||||
@uri = uri(location)
|
||||
@uri = redirect_uri
|
||||
@limit -= 1
|
||||
|
||||
# https redirect, so just cache that whole new domain is https
|
||||
|
Reference in New Issue
Block a user