Page 1 of 1

Websocket request having origin header null in CEF

PostPosted: Wed Feb 02, 2022 7:50 am
by vbnsit
Hello everybody,

We recently upgraded CEF from 4324 to 4606 version . we are using websocket(ws:// schema) via javascript to connect to a service on local host .
in 4324 version the origin header is being passed as "file://" but in 4606 origin header is "null"
we have a check at the service for localhost or file:// to be only valid values in origin
ws:// is a standard schema i am not sure why null is being passed for it.
can anybody suggest any workaround/solution for either changing its origin header value or any other way and why this change has been done ?
to me fix for https://bitbucket.org/chromiumembedded/cef/issues/3105 this issue might have introduced this change
Please suggest
Screenshot 2022-02-02 at 6.10.48 PM.png
Screenshot 2022-02-02 at 6.10.48 PM.png (89.9 KiB) Viewed 24822 times

Re: Websocket request having origin header null in CEF

PostPosted: Wed Feb 02, 2022 10:50 am
by magreenblatt
How does it behave in Google Chrome at the same version?

Re: Websocket request having origin header null in CEF

PostPosted: Thu Feb 03, 2022 3:13 am
by vbnsit
magreenblatt wrote:How does it behave in Google Chrome at the same version?

the behaviour is same null is passed in origin header for same Google Chrome version
any suggestions on this how to have previous behaviour and why it is changed?

Re: Websocket request having origin header null in CEF

PostPosted: Thu Feb 03, 2022 10:47 am
by magreenblatt
in 4324 version the origin header is being passed as "file://" but in 4606 origin header is "null"

Are you initializing the websocket request from a file URL? Origin being "null" for file URLs is expected behavior according to https://developer.mozilla.org/en-US/doc ... escription

Re: Websocket request having origin header null in CEF

PostPosted: Thu Feb 03, 2022 4:46 pm
by vbnsit
magreenblatt wrote:
in 4324 version the origin header is being passed as "file://" but in 4606 origin header is "null"

Are you initializing the websocket request from a file URL? Origin being "null" for file URLs is expected behavior according to https://developer.mozilla.org/en-US/doc ... escription

websocket request is initialzed with "ws://" URL like ("ws://127.0.0.1:59536/?version=16&token=565656-786-4e2d-778-667)
the javascript file which has websocket request code is loaded from local file system in CEF possibly that is leading to "file://" in 4324 version ?
i am thinking to build CEF with reverting this patch
(https://bitbucket.org/chromiumembedded/ ... 1397.patch ) which probably introduced the change to null
can you suggest if this could be the solution for now or any other ways to handle it?

Re: Websocket request having origin header null in CEF

PostPosted: Thu Feb 03, 2022 5:23 pm
by magreenblatt
I don't think that patch file is related. Why is the "null" origin header a problem for you?

Re: Websocket request having origin header null in CEF

PostPosted: Fri Feb 04, 2022 4:45 am
by vbnsit
magreenblatt wrote:I don't think that patch file is related. Why is the "null" origin header a problem for you?

Yes that patch file is not related it didn't work on reversing it.
"null" origin is blocker for our client application release as we cannot change the server part for now (service running on localhost along with client application) as there release is freezed and rolled out .
For the long term we will add the null handling but currently since this change came as a surprise in CEF we are trying to figure if we can have any workaround/solution in CEF for our client release
on further digging i found the "null" change started from 4515 version (the first beta build of 4515 also had the issue checked on spotify ) can you guide on any commits or changes in 4515 which led to this change ? In first few commits of 4515 the change occurred . Attaching images of 4472 and 4515 CEF version websocket request headers

Re: Websocket request having origin header null in CEF

PostPosted: Fri Feb 04, 2022 11:42 am
by magreenblatt
Code: Select all
can you guide on any commits or changes in 4515 which led to this change ?

Sorry, I can't. You will need to fix your client not to use file URLs, or fix your server's origin expectations. Consider hosting the file contents via a standard scheme (like http) as documented here. Then the origin can be whatever you choose (like "myapp.com").