0

I Have attached 2 images. First Image is the very fist time when I load the website where the service-worker is registered. There are 2 arrow mark that shows 302 found and sets the cookies of session information. enter image description here

This is the second time (refer the below image) , After I sign out and sign in again using google i am getting the below image as a response. You can see from the image there are no cookies set and it is actually from service worker.

enter image description here

This is my ngsw-config.json , from the docs Reference I have made it as "navigationRequestStrategy": "freshness", But still it doesnt work.

{
  "$schema": "./node_modules/@angular/service-worker/config/schema.json",
  "index": "/index.html",
  "navigationUrls": [
    "! /**/*callback*"
  ],
  "navigationRequestStrategy": "freshness",
  "assetGroups": [
    {
      "name": "app",
      "installMode": "prefetch",
      "resources": {
        "files": [
          "/favicon.ico",
          "/manifest.webmanifest",
          "/*.css",
          "/*.js"
        ]
      }
    },
    {
      "name": "assets",
      "installMode": "lazy",
      "updateMode": "prefetch",
      "resources": {
        "files": [
          "/assets/**",
          "/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
        ]
      }
    }
  ]
}

1 Answer 1

0

So the service worker was caching the api response and returned from the cache. To bypass the service worker for certain apis. Either add salt or use ngsw-bypass in the queryparams.

Bypass Service Worker Caching in APIs

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.