Class: Server::NonCachingFileHandler

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

Instance Method Summary collapse

Instance Method Details

#do_GET(req, res) ⇒ Object



13
14
15
16
# File 'lib/server.rb', line 13

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

#prevent_caching(res) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/server.rb', line 5

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