389e3f5a8c
This allows manually changing the filename so that fiel header changes can be reflected on the CDN. E.g. if you turn on crossOrigin serving (CORS) the asset hash doesn't change, but the CDN cache needs to be broken in order to pickup the new header.
16 lines
393 B
Ruby
16 lines
393 B
Ruby
class Middleware
|
|
def initialize(app)
|
|
@app = app
|
|
end
|
|
|
|
def call(env)
|
|
status, headers, response = @app.call(env)
|
|
body = ''
|
|
response.each {|part| body += part }
|
|
if (env["PATH_INFO"] =~ /css$/)
|
|
body += "\n/* Added by Rack filter */"
|
|
status, headers, response = Rack::Response.new(body, status, headers).finish
|
|
end
|
|
[status, headers, response]
|
|
end
|
|
end
|