Service Worker in root on GAE

独自空忆成欢 提交于 2019-12-24 07:19:21

问题


I am trying to use a service worker on a basic flask app on Google App Engine for Python. From what I understand if I want the service worker to handle all requests on my domain it needs to be in the application root. However I can't figure out how to let GAE allow access to my service-worker.js in the root. I currently get a 404 response when trying to register the service worker. Any help would be much appreciated, thanks.


回答1:


You can configure this via the static_files option in your app.yaml, as described in the documentation.

You should probably opt your /service-worker.js out of caching at the same time.

Something like:

handlers:
- url: /service-worker\.js
  static_files: service-worker.js
  upload: service-worker\.js
  expiration: 0m


来源:https://stackoverflow.com/questions/44081610/service-worker-in-root-on-gae

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!