From 0de0a90f8fe5e1e48fa4ec7aa7c825ef88770f9d Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Mon, 9 Sep 2019 23:55:02 -0400 Subject: [PATCH] Enable file access and universal access for file URLs When loading a local file, instead of disabling CEF's web security, enable file access and universal access for file URLs. This should allow local files to make CORS requests without completely disabling CEF's security model. --- obs-browser-source.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/obs-browser-source.cpp b/obs-browser-source.cpp index ab1181e..c775283 100644 --- a/plugins/obs-browser/obs-browser-source.cpp +++ b/plugins/obs-browser/obs-browser-source.cpp @@ -179,9 +179,12 @@ bool BrowserSource::CreateBrowser() #if ENABLE_LOCAL_FILE_URL_SCHEME if (is_local) { - /* Disable web security for file:// URLs to allow - * local content access to remote APIs */ - cefBrowserSettings.web_security = STATE_DISABLED; + /* Enable file access and universal access from file:// + * URLs to allow local content access to remote APIs */ + cefBrowserSettings.file_access_from_file_urls = + STATE_ENABLED; + cefBrowserSettings.universal_access_from_file_urls = + STATE_ENABLED; } #endif -- 2.31.1