Open CocoaTouch123 opened 6 years ago
With no-cors response status is unknown and is reported with 0
. Which isn't 200
. Basically, ServiceWorker isn't able to detect if resource fetching errored or not, so offline-plugin
doesn't cache such resources.
Use cors
at setup CORS headers on your second domain.
Thank you very much for answering my question. but the b site related resources are external resources, I am not the owner, offline-plugin how to set it
If you don't set mode:"no-cros", my homepage will complain:
Failed to load https://b.myhost.com/station/site/common/mobilehome/css/bank-module-public.css:
The 'Access-Control-Allow-Origin' header contains the invalid value '0'. Origin ' https://a.myhost.com/'
is therefore not allowed access. Have the server send the header with a valid value, or, if an opaque
response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
If sw Caches all of the site's home page, how can offline-plugin notify the client if the index.html changes?
Thank you very much for answering my question. but the b site related resources are external resources, I am not the owner, offline-plugin how to set it
Well, you either move it to your domain or don't cache them at all in this situation. You may also setup cacheMaps
to redirect external domain requests to local/cached requests when ServiceWorker is used.
If sw Caches all of the site's home page, how can offline-plugin notify the client if the index.html changes?
Not sure how this is related.
The main domain name of my website is https://a.myhost.com/. When I set up the external link https://b.myhost.com/.., I added mode: 'no-cors'. After I refreshed the page, the console reported an error.
My configuration for this the OfflinePlugin is:
My production generated ServiceWorker file is:
Can you tell me why did this error occur?