Currently, page caching caches any request w/ a status code < 400. Is there a reason for this?
#6514 changes it to only cache 200 requests, and includes some actual page caching tests. Thoughts?
Currently, page caching caches any request w/ a status code < 400. Is there a reason for this?
#6514 changes it to only cache 200 requests, and includes some actual page caching tests. Thoughts?
I did something fairly similar on my one site that uses page caching extensively:
after_filter :cache_all_pages def cache_all_pages cache_page if request.get? && response.headers['Status'] == "200 OK" && request.env['REQUEST_URI'] !~ /\?/ end
Your checking for a 200 status is better (since it uses to_i), but you should only cache get requests (not sure how your code handles head requests), and requests with URL parameters shouldn't be cached.
Jeremy