Hello,
i work on with angular pwa project with spring-boot back end.
In my project, i am using Angular and Spring boot. My service worker is generating by Angular when i build my project.
I use external service (auth2) and my back-end redirecting to login page when session times out. This works perfectly fine without the service worker enabled, however with the service worker this fails.
To my observation, the mode of the Request is changed from navigate to cors. i see that in request headers
Without SW:
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
With SW:
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
When active service worker, i have this exception :
Access to fetch at 'https://authentication-url.com/...' (redirected from 'https://my-w ebsite.com/file-request.json') from origin 'https://my-website.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
I tried adding ngsw-bypass=true query param to the redirect, but that did not help.
Can you help me ? I search on web but i found nothing on this problem with Angular service worker.
🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑
Hello,
i work on with angular pwa project with spring-boot back end.
In my project, i am using Angular and Spring boot. My service worker is generating by Angular when i build my project.
I use external service (auth2) and my back-end redirecting to login page when session times out. This works perfectly fine without the service worker enabled, however with the service worker this fails.
To my observation, the mode of the Request is changed from navigate to cors. i see that in request headers
Without SW:
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
With SW:
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
When active service worker, i have this exception :
Access to fetch at 'https://authentication-url.com/...' (redirected from 'https://my-w ebsite.com/file-request.json') from origin 'https://my-website.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.I tried adding ngsw-bypass=true query param to the redirect, but that did not help.
Can you help me ? I search on web but i found nothing on this problem with Angular service worker.
🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑