GAE上的根服务工作者 [英] Service Worker in root on GAE
问题描述
我正在尝试在适用于Python的Google App Engine的基本烧瓶应用程序上使用服务工作者.据我了解,如果我希望服务人员处理我域中的所有请求,则它必须位于应用程序根目录中.但是我不知道如何让GAE允许从根目录访问我的service-worker.js.尝试注册服务工作者时,我目前收到404响应.任何帮助将不胜感激,谢谢.
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.
推荐答案
您可以通过 app.yaml
中的 static_files
选项将其配置为.
You can configure this via the static_files
option in your app.yaml
, as described in the documentation.
您可能应该选择您的/同时退出service-worker.js
.
You should probably opt your /service-worker.js
out of caching at the same time.
类似的东西:
handlers:
- url: /service-worker\.js
static_files: service-worker.js
upload: service-worker\.js
expiration: 0m
这篇关于GAE上的根服务工作者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!