1

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.

ScottyLa
  • 117
  • 2
  • 7

1 Answers1

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
Jeff Posnick
  • 53,580
  • 14
  • 141
  • 167
  • Thanks that worked but I also had to make sure my catch all handler `url: ./*` came after the service-worker url handler. – ScottyLa Jun 01 '17 at 01:54
  • this solution works for me when i run it locally, but does not work after deploying (i'm getting 404). any idea why? – parthi82 Jul 26 '17 at 12:14