Sha256: 620a3a14431b3615f11a08394f7965bc5de42302549afda8b88ab0746f2b3514
Contents?: true
Size: 832 Bytes
Versions: 25
Compression:
Stored size: 832 Bytes
Contents
module Macmillan module Utils module Middleware ## # Rack Middleware for use when proxying a rack app with Nginx using gzip compression. # # Nginx will convert ETags generated by our rack apps from STRONG etags, to WEAK etags, # this middleware converts the ETags back to STRONG for use within the consuming app. # # @ref http://akshaykarle.com/blog/2014/09/17/rails-caching-with-nginx/ class WeakEtags def initialize(app) @app = app end def call(env) dup.process(env) end def process(env) etag = env['HTTP_IF_NONE_MATCH'] if etag && etag.match(/^W\//) env['HTTP_IF_NONE_MATCH'] = etag.gsub(/^W\//, '') end @app.call(env) end end end end end
Version data entries
25 entries across 25 versions & 1 rubygems