From cec326db89c7a1413d16b6d34b77e70d16b99ae9 Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Mon, 24 Feb 2020 16:28:43 -0800 Subject: [PATCH] Open `/events` for locally served javascript files as well When using a production build of flipper, the network requests are made from a pre-bundled javascript file, which results in an origin header based on a local file url. In a future we will make sure that this origin is consistent both in prod- and non-prod builds, but for compatibility reasons making sure it will be compatible with the next react-native CLI version as well Facebook: this corresponds with diff D20001690 --- packages/cli/src/commands/server/eventsSocket.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/commands/server/eventsSocket.ts b/packages/cli/src/commands/server/eventsSocket.ts index e3dbe3e51..e02c6b1ff 100644 --- a/packages/cli/src/commands/server/eventsSocket.ts +++ b/packages/cli/src/commands/server/eventsSocket.ts @@ -125,7 +125,9 @@ function attachToServer( verifyClient({origin}: {origin: string}) { // This exposes the full JS logs and enables issuing commands like reload // so let's make sure only locally running stuff can connect to it - return origin.startsWith('http://localhost:'); + return ( + origin.startsWith('http://localhost:') || origin.startsWith('file:') + ); }, });