Class: Webify::Backend::WebrickNoCacheFileHandler

Inherits:
WEBrick::HTTPServlet::FileHandler
  • Object
show all
Defined in:
lib/webify/backend/webrick.rb

Instance Method Summary collapse

Instance Method Details

#do_GET(req, res) ⇒ Object



15
16
17
18
# File 'lib/webify/backend/webrick.rb', line 15

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

#prevent_caching(res) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/webify/backend/webrick.rb', line 7

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