For one controller (only), I'd like to use an ETag value generated outside of rails caching logic, and manage 304-vs-200 responses myself. It seems that nothing I do to set the ETag header works:
response.etag = myEtag
headers['ETag'] = myEtag
render :text => myText, :etag => myEtag
Rails always uses its own version.
I know I could disable caching app-wide, but I don't want that - just want to override it in the responses for one ActionController
subclass.
fresh_when
, etc. didn't quite suit my needs - in my case the solution was to refuse caching via
def caching_allowed?
false
end
then set just the headers['ETag']
member on my response - setting any of the .etag
options seems to cause Rails to MD5 All The Things.