Our front-end is Angular and Backend is .Net Core 2.2. I experienced intermittent CORS error (or might be some other issue) when calling from front-end to backend.
When we call backend API in Chrome, Chrome sometimes throws error in the console "...has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.", causing webpag not loading. When error happens, there is no response content and no response header. And the issue could happen when I disable cache (with header or chrome's devtool) and disable CORS (with Chrome Extension).
I guess browser is not able to parse the response body, So I used fiddler to track the response:
Initially I only got Empty Trunk "30 0D 0A 0D 0A" and Fiddler received 500 error. At the same time, Chrome throws CROS error and webpage doesn't load.
And if I wait for 30 seconds to 1 minute, the Fiddler record changed from 500 (failure) to 200 (successful):
It made me think it might be an issue with chunked Transfer-Encoding (as shown in the third picture), so I tried to disable chunked encoding via assigning Response header the ContentLength. But issue still persists.
Kind of desperate on this error. Any insight/suggestion would be really appreciated!
All right. Seems root cause "detected" -- Our company synchronizes user folders to virtual drive automatically, like Pictures/Documents/Temp Folders are all synced to virtual drive. That function ensures no data loss and easier workstation replacement, but we're experiencing a lot of delay when trying to do copy/paste or open any user folder. So once I went to airplane mode or only hit F5 rather than Ctrl+F5, I don't experience the intermittent CORS issue any more. I guess Chrome thinks it's CORS issue perhaps because the response is injected by this 'proxy' layer.
If anyone has done following things:
Please check if your company has similar synchronization set up...