Skip to content
This repository
Browse code

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
David Heinemeier Hansson authored April 17, 2005
6  actionpack/lib/action_controller/caching.rb
@@ -114,10 +114,10 @@ def expire_page(options = {})
114 114
         return unless perform_caching
115 115
         if options[:action].is_a?(Array)
116 116
           options[:action].dup.each do |action|
117  
-            self.class.expire_page(url_for(options.merge({ :only_path => true, :action => action })))
  117
+            self.class.expire_page(url_for(options.merge({ :only_path => true, :skip_relative_url_root => true, :action => action })))
118 118
           end
119 119
         else
120  
-          self.class.expire_page(url_for(options.merge({ :only_path => true })))
  120
+          self.class.expire_page(url_for(options.merge({ :only_path => true, :skip_relative_url_root => true })))
121 121
         end
122 122
       end
123 123
 
@@ -126,7 +126,7 @@ def expire_page(options = {})
126 126
       #   cache_page "I'm the cached content", :controller => "lists", :action => "show"
127 127
       def cache_page(content = nil, options = {})
128 128
         return unless perform_caching && caching_allowed
129  
-        self.class.cache_page(content || @response.body, url_for(options.merge({ :only_path => true })))
  129
+        self.class.cache_page(content || @response.body, url_for(options.merge({ :only_path => true, :skip_relative_url_root => true })))
130 130
       end
131 131
 
132 132
       private
4  actionpack/lib/action_controller/url_rewriter.rb
@@ -2,7 +2,7 @@ module ActionController
2 2
   # Rewrites URLs for Base.redirect_to and Base.url_for in the controller.
3 3
 
4 4
   class UrlRewriter #:nodoc:
5  
-    RESERVED_OPTIONS = [:anchor, :params, :only_path, :host, :protocol, :trailing_slash]
  5
+    RESERVED_OPTIONS = [:anchor, :params, :only_path, :host, :protocol, :trailing_slash, :skip_relative_url_root]
6 6
     def initialize(request, parameters)
7 7
       @request, @parameters = request, parameters
8 8
     end
@@ -23,7 +23,7 @@ def rewrite_url(path, options)
23 23
         rewritten_url << (options[:protocol] || @request.protocol) unless options[:only_path]
24 24
         rewritten_url << (options[:host] || @request.host_with_port) unless options[:only_path]
25 25
 
26  
-        rewritten_url << @request.relative_url_root.to_s
  26
+        rewritten_url << @request.relative_url_root.to_s unless options[:skip_relative_url_root]
27 27
         rewritten_url << path
28 28
         rewritten_url << '/' if options[:trailing_slash]
29 29
         rewritten_url << "##{options[:anchor]}" if options[:anchor]

0 notes on commit 7cda492

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