mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00:00
fix: cors header handling (#1900)
This commit is contained in:
@@ -23,9 +23,18 @@ export function registerProtocol() {
|
||||
|
||||
session.defaultSession.webRequest.onHeadersReceived(
|
||||
(responseDetails, callback) => {
|
||||
const { responseHeaders, url } = responseDetails;
|
||||
const { responseHeaders } = responseDetails;
|
||||
if (responseHeaders) {
|
||||
delete responseHeaders['access-control-allow-origin'];
|
||||
delete responseHeaders['access-control-allow-methods'];
|
||||
responseHeaders['Access-Control-Allow-Origin'] = ['*'];
|
||||
responseHeaders['Access-Control-Allow-Methods'] = [
|
||||
'GET',
|
||||
'POST',
|
||||
'PUT',
|
||||
'DELETE',
|
||||
'OPTIONS',
|
||||
];
|
||||
}
|
||||
|
||||
callback({ responseHeaders });
|
||||
|
||||
Reference in New Issue
Block a user