Force Sec-Fetch-Site header to 'none'

Reviewed By: bartoszniemczura

Differential Revision: D30047497

fbshipit-source-id: 0d9376c09d63176031291f19bfe82a56d5677641
This commit is contained in:
Anton Nikolaev
2021-08-05 02:39:50 -07:00
committed by Facebook GitHub Bot
parent 0df3a19e98
commit cc4064ec9f
2 changed files with 7 additions and 0 deletions

View File

@@ -102,6 +102,10 @@ async function handlePluginDownload(
adapter: axiosHttpAdapter, adapter: axiosHttpAdapter,
cancelToken: cancellationSource.token, cancelToken: cancellationSource.token,
responseType: 'stream', responseType: 'stream',
headers: {
'Sec-Fetch-Site': 'none',
'Sec-Fetch-Mode': 'navigate',
},
onDownloadProgress: async (progressEvent) => { onDownloadProgress: async (progressEvent) => {
const newPercentCompleted = !progressEvent.total const newPercentCompleted = !progressEvent.total
? 0 ? 0

View File

@@ -253,6 +253,9 @@ function configureSession() {
urls: ['*://*/*'], urls: ['*://*/*'],
}, },
(details, callback) => { (details, callback) => {
// setting sec-fetch-site to always be 'none' so Flipper requests are not blocked by SecFetch policies
details.requestHeaders['Sec-Fetch-Site'] = 'none';
details.requestHeaders['Sec-Fetch-Mode'] = 'navigate';
// setting Origin to always be 'localhost' to avoid issues when dev version and release version behaves differently. // setting Origin to always be 'localhost' to avoid issues when dev version and release version behaves differently.
details.requestHeaders.origin = 'http://localhost:3000'; details.requestHeaders.origin = 'http://localhost:3000';
details.requestHeaders.referer = 'http://localhost:3000/index.dev.html'; details.requestHeaders.referer = 'http://localhost:3000/index.dev.html';