Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
任意のassetsのレスポンスヘッダにService-Worker-Allowdヘッダを追加するRack Middleware
class RackSwHeader
def initialize(app, config = [])
@app = app
@config = config
end
def call(env)
status, headers, body = @app.call env
path = env["PATH_INFO"]
@config.each do |entry|
next unless path == entry[:path]
headers["Service-Worker-Allowed"] = entry[:scope]
end
[status, headers, body]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.