docbrown/config/initializers/serviceworker.rb
cyrillefr 4fd66372dc Enable Layout/AlignParameters (#2340)
Check if the parameters on a multi-line method call or definition are aligned.

Resolves: #2021
2019-04-08 18:47:34 -04:00

29 lines
1.3 KiB
Ruby

Rails.application.configure do
config.serviceworker.routes.draw do
# map to assets implicitly
match "/serviceworker.js",
headers: { "Cache-Control" => "public, max-age=8000, s-max-age=20000, no-cache" }
match "/manifest.json",
headers: { "Cache-Control" => "public, max-age=8000, s-max-age=20000, no-cache" }
# Examples
#
# map to a named asset explicitly
# match "/proxied-serviceworker.js" => "nested/asset/serviceworker.js"
# match "/nested/serviceworker.js" => "another/serviceworker.js"
#
# capture named path segments and interpolate to asset name
# match "/captures/*segments/serviceworker.js" => "%{segments}/serviceworker.js"
#
# capture named parameter and interpolate to asset name
# match "/parameter/:id/serviceworker.js" => "project/%{id}/serviceworker.js"
#
# insert custom headers
# match "/header-serviceworker.js" => "another/serviceworker.js",
# headers: { "X-Resource-Header" => "A resource" }
#
# anonymous glob exposes `paths` variable for interpolation
# match "/*/serviceworker.js" => "%{paths}/serviceworker.js"
end
config.serviceworker.headers["Surrogate-Control"] = "max-age=20000"
config.serviceworker.headers["Cache-Control"] = "public, s-maxage=20000, max-age=0, no-cache"
end