Class: Workarea::SkipRackCacheMiddleware

Inherits:
Object
  • Object
show all
Defined in:
app/middleware/workarea/skip_rack_cache_middleware.rb

Overview

TODO here for legacy support, remove in v4

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ SkipRackCacheMiddleware

Returns a new instance of SkipRackCacheMiddleware.



4
5
6
# File 'app/middleware/workarea/skip_rack_cache_middleware.rb', line 4

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'app/middleware/workarea/skip_rack_cache_middleware.rb', line 8

def call(env)
  request = Rack::Request.new(env)

  if request.path !~ /(jpe?g|png|ico|gif|css|js)$/ &&
      request.cookies['cache'] == 'false'
    env["rack-cache.force-pass"] = true
  end

  @app.call(env)
end