Select to view content in your preferred language

ArcGIS Online portal Item and CORS errors

340
1
08-14-2023 09:12 AM
BhavinSanghani
Occasional Contributor II

I see sometimes CORS errors while loading map using Layer.fromPortalItem({}).

I notice "X:Cache Errors from cloudfront" in the request headers. 

Since this is not always reproducible, I wonder if the CORS errors are due to this reason. Is there any other area I need to look at? Or is there any configurations to avoid CORS errors while loading map using ArcGIS Online item Id?

 

 

0 Kudos
1 Reply
TatianaGP
Esri Contributor

Hi BhavinSanghani 

Verifying the information the  "X:Cache Errors from cloudfront" in the request headers.  It was resolved in another post. You will have to verify some items whether origin caching headers conflict with your distribution's custom object caching, verify these steps according with the issues that you have it. 

  • The Minimum TTL and Default TTL are set to 0, but there are still hits from CloudFront  
< HTTP/1.1 200 OK< Content-Type: text/html
< Content-Length: 437
< Connection: keep-alive
< Date: Sat, 03 Feb 2018 19:26:45 GMT
< Last-Modified: Sat, 03 Feb 2018 19:25:24 GMT
< ETag: "example12345abcdefghijklmno54321"
< Cache-Control: max-age=300, Public
< Accept-Ranges: bytes
< Server: AmazonS3
< Age: 14
< X-Cache: Hit from cloudfront
  • The Maximum TTL and Default TTL are greater than 0, but there are misses from CloudFront
< HTTP/1.1 200 OK< Content-Type: text/html
< Content-Length: 437
< Connection: keep-alive
< Date: Sat, 03 Feb 2018 19:26:45 GMT
< Last-Modified: Sat, 03 Feb 2018 19:25:24 GMT
< ETag: "example12345abcdefghijklmno54321"
< Cache-Control: no-cache, no-store
< Accept-Ranges: bytes
< Server: AmazonS3
< X-Cache: Miss from cloudfront
  • CloudFront is caching error responses

There is this article that may be of help: https://repost.aws/knowledge-center/cloudfront-custom-object-caching

Regards, 
Tatiana

0 Kudos