CoreLibs
CoreLibs copied to clipboard
Request with Authorization header is not redirected
It seems that some request are not redirected.
Steps to reproduce:
- Add this rule:
||pagead2.googlesyndication.com/pagead/js/adsbygoogle.js$xmlhttprequest,redirect=googlesyndication-adsbygoogle
- Go to - https://example.org/
- In browser console run:
(() => {
function reqListener() {
console.log(this.responseText);
}
function adblock() {
alert('Request blocked');
}
const req = new XMLHttpRequest();
req.addEventListener('load', reqListener);
req.addEventListener('error', adblock);
req.open('GET', 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js');
req.setRequestHeader('Authorization', {});
req.send();
})();
Expected behavior
Request should be redirected.
Actual behavior
Request is blocked with error:
Access to XMLHttpRequest at 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js' from origin 'https://example.org' has been blocked by CORS policy: Request header field authorization is not allowed by Access-Control-Allow-Headers in preflight response.
Screenshot
[!NOTE] Redirection works fine with AdGuard extension. It looks like that problem occurs when there is
Authorizationheader.AdGuard for Windows 7.16.0 nightly 18 (4547) (CL 1.13.115, DL 2.4.37 )