Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed page caching for non-vhost applications living underneath the r…

…oot #1004 [Ben Schumacher]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1193 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 7cda49248b5269b1aaf96729a31f85a315fbb764 1 parent 7ff635c
@dhh dhh authored
View
6 actionpack/lib/action_controller/caching.rb
@@ -114,10 +114,10 @@ def expire_page(options = {})
return unless perform_caching
if options[:action].is_a?(Array)
options[:action].dup.each do |action|
- self.class.expire_page(url_for(options.merge({ :only_path => true, :action => action })))
+ self.class.expire_page(url_for(options.merge({ :only_path => true, :skip_relative_url_root => true, :action => action })))
end
else
- self.class.expire_page(url_for(options.merge({ :only_path => true })))
+ self.class.expire_page(url_for(options.merge({ :only_path => true, :skip_relative_url_root => true })))
end
end
@@ -126,7 +126,7 @@ def expire_page(options = {})
# cache_page "I'm the cached content", :controller => "lists", :action => "show"
def cache_page(content = nil, options = {})
return unless perform_caching && caching_allowed
- self.class.cache_page(content || @response.body, url_for(options.merge({ :only_path => true })))
+ self.class.cache_page(content || @response.body, url_for(options.merge({ :only_path => true, :skip_relative_url_root => true })))
end
private
View
4 actionpack/lib/action_controller/url_rewriter.rb
@@ -2,7 +2,7 @@ module ActionController
# Rewrites URLs for Base.redirect_to and Base.url_for in the controller.
class UrlRewriter #:nodoc:
- RESERVED_OPTIONS = [:anchor, :params, :only_path, :host, :protocol, :trailing_slash]
+ RESERVED_OPTIONS = [:anchor, :params, :only_path, :host, :protocol, :trailing_slash, :skip_relative_url_root]
def initialize(request, parameters)
@request, @parameters = request, parameters
end
@@ -23,7 +23,7 @@ def rewrite_url(path, options)
rewritten_url << (options[:protocol] || @request.protocol) unless options[:only_path]
rewritten_url << (options[:host] || @request.host_with_port) unless options[:only_path]
- rewritten_url << @request.relative_url_root.to_s
+ rewritten_url << @request.relative_url_root.to_s unless options[:skip_relative_url_root]
rewritten_url << path
rewritten_url << '/' if options[:trailing_slash]
rewritten_url << "##{options[:anchor]}" if options[:anchor]

0 comments on commit 7cda492

Please sign in to comment.
Something went wrong with that request. Please try again.