diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-04-10 15:34:55 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-04-10 15:34:55 -0300 |
commit | 085ce4f1411238a6109fb9c22fdb2c46b27c2c0e (patch) | |
tree | e57262b3e867ee6fef40e63e09619fffde075d8e /actionpack/lib/action_dispatch/middleware/ssl.rb | |
parent | 54d8c81fefdb566c2f317afd0142cade0273bdbc (diff) | |
parent | 53610e5140149aca3a15a27ef103350a5969f7aa (diff) | |
download | rails-085ce4f1411238a6109fb9c22fdb2c46b27c2c0e.tar.gz rails-085ce4f1411238a6109fb9c22fdb2c46b27c2c0e.tar.bz2 rails-085ce4f1411238a6109fb9c22fdb2c46b27c2c0e.zip |
Merge branch 'master' into rm-uuid-fixtures
Conflicts:
activerecord/CHANGELOG.md
activesupport/CHANGELOG.md
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware/ssl.rb')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/ssl.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/ssl.rb b/actionpack/lib/action_dispatch/middleware/ssl.rb index 999c022535..0c7caef25d 100644 --- a/actionpack/lib/action_dispatch/middleware/ssl.rb +++ b/actionpack/lib/action_dispatch/middleware/ssl.rb @@ -32,11 +32,14 @@ module ActionDispatch private def redirect_to_https(request) - url = URI(request.url) - url.scheme = "https" - url.host = @host if @host - url.port = @port if @port - headers = { 'Content-Type' => 'text/html', 'Location' => url.to_s } + host = @host || request.host + port = @port || request.port + + location = "https://#{host}" + location << ":#{port}" if port != 80 + location << request.fullpath + + headers = { 'Content-Type' => 'text/html', 'Location' => location } [301, headers, []] end |