0

I have an image upload API which makes a PUT request that includes a body with the image binary ( body: { file: [dom-file-object] } ). When the service worker is enabled, the body is excluded for the image upload api call. When the service worker is disabled, the api call works as expected.

How do you configure the service worker to ignore all PUT requests?

Bill Bensing
  • 193
  • 2
  • 17

1 Answers1

1

I found my answer with the help with this other StackOverflow post:

The api begins with "/media" and has many endpoints, therefore by adding "!/media/**" to the data groups, I ensure all routes are ignored. Anything with a "!" in front of it will be ignored.

"dataGroups": [
  { "name": "media-api",
    "urls": ["!/media/**"],
    "cacheConfig": {
      "maxSize": 0,
      "maxAge": "0u",
      "strategy": "freshness"
    }
  }
]
Bill Bensing
  • 193
  • 2
  • 17