Exclude sw.js from the long term caching with glob pattern matching

Viewed 175

In order to enable long term caching, per the Firebase documentation, I have this in the headers configuration:

"headers": [
  {
    "source": "**/*.@(jpg|jpeg|gif|png|js|css)",
    "headers": [
      {
        "key": "Cache-Control",
        "value": "max-age=172800"
      }
    ]
  }
]

But I'm also serving a sw.js (service worker) for the app, which I don't want to be cached at all. First thing that comes to mind is to exclude it from the glob matching, which I need help for. Otherwise, if you think there's a better way, do tell. Thanx.

1 Answers
Related