In your application.rb configuration block, try adding:
config.action_controller.page_cache_extension = '.html'
It should ignore the expansion calculated on demand, and always use it. You can also try using this with an empty string.
EDIT: this will not actually work, because it only sets the default value. If the request has an extension (in your case, concluded from: format), it will be used.
I suggest changing: the format in your routes to something else that the rails will not attach much importance to, for example: fmt. Then the rails should not add an extension, but the default is ".html".
EDIT2: If you need to use: format, you can defuse Rails:
ActionController::Caching::Pages::ClassMethods private def page_cache_file(path) name = (path.empty? || path == "/") ? "/index" : URI.unescape(path.chomp('/')) name << page_cache_extension #unless (name.split('/').last || name).include? '.' return name end end
Notice the comment mark I added before the if. This is the part that overrides the default value from my first answer.
source share