Description
I have problems with some services - Google Photos, Google Drive (open a few directories down), Twitter and some others (I do not remember a full list).
It always says error is CORS, but I did a debug and the header seemed fine.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://drivefrontend-pa.clients6.google.com/v1/sharedDrives:list?key=.... (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 400
Google answers with 400 Bad Request!!!, same error sometimes appear when cookies are broken but cookies are
synchronized and this error still appears.
While debugging I thought I found the issue in this part (letter case can be different and origin will be there twice):
details.requestHeaders = details.requestHeaders.filter(requestHeader => {
return !header_keys_to_delete.includes(requestHeader.name);
});
// Add appended headers
details.requestHeaders = details.requestHeaders.concat(
headers_to_append
);
Changed it to:
details.requestHeaders = details.requestHeaders.filter((requestHeader) => {
return !header_keys_to_delete.includes(requestHeader.name);
});
for (const header of headers_to_append) {
const headerIndex = details.requestHeaders.findIndex(
(h) => h.name.toLowerCase() === header.name.toLowerCase(),
);
if (headerIndex !== -1) {
details.requestHeaders[headerIndex].value = header.value;
} else {
details.requestHeaders.push(header);
}
}
But it changed nothing.
Hope someone has an idea what's the root cause of the issue.