Redirected request trigger Access denied error
Describe the bug Redirected request lose sec-ch-ua headers and trigger Access denied error
To Reproduce Steps to reproduce the behavior:
- Go to https://www.mouser.com/
- Enter a text in the search field
- Click on the icon loop or hit the enter key
- See the Access denied error
Expected behavior The redirected url may not trigger an error
Screenshots
Versions:
- OS: Ubuntu 22.04
- CEF Version: 134.3.2 (134.0.6998.89)
Additional context The problem doesn't occur with Chromium native
According to the Chromium implmentation, see content/browser/loader/navigation_url_loader_impl.cc and net/url_request/redirect_util.cc , removed headers may be set before merging modified headers. Actually, the following code may fix the issue:
diff --git a/libcef/browser/net_service/proxy_url_loader_factory.cc b/libcef/browser/net_service/proxy_url_loader_factory.cc
index 09a4cf929..feb57a0b5 100644
--- a/libcef/browser/net_service/proxy_url_loader_factory.cc
+++ b/libcef/browser/net_service/proxy_url_loader_factory.cc
@@ -1147,10 +1147,10 @@ void InterceptedRequest::OnProcessRequestHeaders(
id_, request_, redirect_url, modified_headers, removed_headers);
if (!modified_headers->IsEmpty() || !removed_headers->empty()) {
- request_.headers.MergeFrom(*modified_headers);
for (const std::string& name : *removed_headers) {
request_.headers.RemoveHeader(name);
}
+ request_.headers.MergeFrom(*modified_headers);
}
}
See https://bitbucket.org/chromiumembedded/cef/pull-requests/895/
I'm not able to reproduce this issue on Windows with M135 or M136.
Did you test a CEF build with your change and verify that it fixes the issue for you?
I've just tested cefclient (windows build) downloaded from https://cef-builds.spotifycdn.com/cef_binary_135.0.21%2Bgd008a99%2Bchromium-135.0.7049.96_windows32_client.tar.bz2 and got the same result:
@emmanuel-jorge Please test a CEF build with your PR change and report if it fixes the issue for you.
@emmanuel-jorge Ping