mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
FIX: Support old Service Worker source file path to avoid routing errors.
This commit is contained in:
parent
33df2d6a02
commit
d601a6b23c
|
@ -188,7 +188,7 @@ server {
|
||||||
# This big block is needed so we can selectively enable
|
# This big block is needed so we can selectively enable
|
||||||
# acceleration for backups and avatars
|
# acceleration for backups and avatars
|
||||||
# see note about repetition above
|
# see note about repetition above
|
||||||
location ~ ^/(letter_avatar/|user_avatar|highlight-js|stylesheets|favicon/proxied|service-worker-.*.js) {
|
location ~ ^/(letter_avatar/|user_avatar|highlight-js|stylesheets|favicon/proxied|service-worker) {
|
||||||
proxy_set_header Host $http_host;
|
proxy_set_header Host $http_host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
|
|
@ -697,6 +697,12 @@ Discourse::Application.routes.draw do
|
||||||
delete "draft" => "draft#destroy"
|
delete "draft" => "draft#destroy"
|
||||||
|
|
||||||
if service_worker_asset = Rails.application.assets_manifest.assets['service-worker.js']
|
if service_worker_asset = Rails.application.assets_manifest.assets['service-worker.js']
|
||||||
|
# https://developers.google.com/web/fundamentals/codelabs/debugging-service-workers/
|
||||||
|
# Normally the browser will wait until a user closes all tabs that contain the
|
||||||
|
# current site before updating to a new Service Worker.
|
||||||
|
# Support the old Service Worker path to avoid routing error filling up the
|
||||||
|
# logs.
|
||||||
|
get "/service-worker.js" => redirect(service_worker_asset), format: :js
|
||||||
get service_worker_asset => "static#service_worker_asset", format: :js
|
get service_worker_asset => "static#service_worker_asset", format: :js
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user