Accept connections from localhost coming from port 3000
Summary: ^ flipper-server verifies the origin of incoming connections as a way of preventing any host from connecting to flipper. That's good. This change expand the list of allowed origins to include localhost:3000 which is the default origin for Electron apps. Error without this change: ``` Refused socket connection from cross domain request, origin: http://localhost:3000, host: localhost:52342. Expected origins: http://localhost:52342 or http://[::1]:52342 or http://::1:52342. Expected hosts: localhost:52342 or [::1]:52342 or ::1:52342 ``` Reviewed By: passy Differential Revision: D36440363 fbshipit-source-id: 883cadb49f245bca5d0a53a4f58c08cf45dd0189
This commit is contained in:
committed by
Facebook GitHub Bot
parent
d4e623c376
commit
aca1aca29c
@@ -211,8 +211,14 @@ function addWebsocket(server: http.Server, config: Config) {
|
|||||||
const localhostIPV4 = `localhost:${config.port}`;
|
const localhostIPV4 = `localhost:${config.port}`;
|
||||||
const localhostIPV6 = `[::1]:${config.port}`;
|
const localhostIPV6 = `[::1]:${config.port}`;
|
||||||
const localhostIPV6NoBrackets = `::1:${config.port}`;
|
const localhostIPV6NoBrackets = `::1:${config.port}`;
|
||||||
|
const localhostIPV4Electron = 'localhost:3000';
|
||||||
|
|
||||||
const possibleHosts = [localhostIPV4, localhostIPV6, localhostIPV6NoBrackets];
|
const possibleHosts = [
|
||||||
|
localhostIPV4,
|
||||||
|
localhostIPV6,
|
||||||
|
localhostIPV6NoBrackets,
|
||||||
|
localhostIPV4Electron,
|
||||||
|
];
|
||||||
const possibleOrigins = possibleHosts.map((host) => `http://${host}`);
|
const possibleOrigins = possibleHosts.map((host) => `http://${host}`);
|
||||||
|
|
||||||
const verifyClient: VerifyClientCallbackSync = ({origin, req}) => {
|
const verifyClient: VerifyClientCallbackSync = ({origin, req}) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user