class HomeController < ApplicationController
def index
@courses = Course.order(:id).page(params[:page])
expires_in 10.minutes
end
end
So if a single user goes to the same page twice within ten minutes, his browser won't even bother hitting the server to get the page. (Hitting Shift + Refresh can bypass Max Ages)
Disable Middleware that modify the Body
Turn off Rack-Mini-Profiler because it disables caching and ETags in response header.
New Relic changes the body on each request causes automatic ETags to be different every time.
Fix: Move browser monitoring injection after ETag:
Some parts of the response are independent of updated_at:
Session Data
Flash
Form authenticity token
Current user
Views
HTML/CSS
-> Users might see old flash messages or Users might see some other user's content after logout & login, Users might be unable to submit forms after logout & login, Users might see the right content with stale HTML or CSS.
expires_in
So if a single user goes to the same page twice within ten minutes, his browser won't even bother hitting the server to get the page. (Hitting Shift + Refresh can bypass Max Ages)
Disable Middleware that modify the Body
Turn off Rack-Mini-Profiler because it disables caching and ETags in response header. New Relic changes the body on each request causes automatic ETags to be different every time. Fix: Move browser monitoring injection after ETag:
Declarative ETags and the ETagger Gem
Some parts of the response are independent of
updated_at
:-> Users might see old flash messages or Users might see some other user's content after logout & login, Users might be unable to submit forms after logout & login, Users might see the right content with stale HTML or CSS.
Using ETagger gem to solve these problems
Reset all ETags on each deploy (To reset ETags when HTML or CSS changes):