not able to set referer header while modifying cef request

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

not able to set referer header while modifying cef request

Postby chayal » Mon Oct 25, 2021 11:34 am

Hi,
I implemented OnBeforeResourceLoad and modified request headers but I am not able to set Referer header as "about:blank" .
I tried it by 2 methods:
1 . Method I:
CefRequest::HeaderMap headerMap;
request->GetHeaderMap(headerMap);
headerMap.insert(std::make_pair(CefString("Referer"), CefString("about:blank")));
request->SetHeaderMap(headerMap);

2. Method 2:
CefString referrer = "about:blank";
CefRequest::ReferrerPolicy policy = REFERRER_POLICY_ORIGIN;
request->SetReferrer(referrer, policy);

In both the cases I don't see the Referer header added into the list of headers we see on fiddler app.
What is the correct way of doing this.
Thanks in advance.
chayal
Techie
 
Posts: 25
Joined: Sat Oct 02, 2021 4:50 pm

Re: not able to set referer header while modifying cef reque

Postby magreenblatt » Mon Oct 25, 2021 12:03 pm

chayal wrote:I am not able to set Referer header as "about:blank"

You probably can't use "about:blank" for this. Do other referer values work?
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: not able to set referer header while modifying cef reque

Postby chayal » Tue Oct 26, 2021 1:02 am

I did not try other referrer values. My application wants it be "about: blank" only.
Is there a way out ?
chayal
Techie
 
Posts: 25
Joined: Sat Oct 02, 2021 4:50 pm

Re: not able to set referer header while modifying cef reque

Postby magreenblatt » Tue Oct 26, 2021 9:58 am

Changing your application is likely the only option.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 32 guests