Class: NonCachingFileHandler

Inherits:
WEBrick::HTTPServlet::FileHandler
  • Object
show all
Defined in:
lib/white_castle.rb

Instance Method Summary collapse

Instance Method Details

#do_GET(req, res) ⇒ Object



12
13
14
15
# File 'lib/white_castle.rb', line 12

def do_GET(req, res)
  super
  prevent_caching(res)
end

#prevent_caching(res) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/white_castle.rb', line 4

def prevent_caching(res)
  res['ETag']          = nil
  res['Last-Modified'] = Time.now + 100**4
  res['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0'
  res['Pragma']        = 'no-cache'
  res['Expires']       = Time.now - 100**4
end