Skip to content

Commit

Permalink
Fix: allow Hermes Debugger to connect from Flipper (#1086)
Browse files Browse the repository at this point in the history
* Fix: allow Hermes Debugger to connect from Flipper

This change reflects D20526486 by @rickhanlonii  at Facebook: when Running Hermes Debugger from inside Flipper, the origin is localhost, but not the metro port. This fixes facebook/flipper#660 (comment)

* Fixed compile errors

* Fix lint error
  • Loading branch information
mweststrate authored Mar 31, 2020
1 parent a4a0f78 commit 9a5062c
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@ export default function getSecurityHeadersMiddleware(
res: http.ServerResponse,
next: (err?: any) => void,
) {
// @ts-ignore Property 'client' does not exist on type 'IncomingMessage', verify
const address = req.client.server.address();

// Block any cross origin request.
if (
req.headers.origin &&
req.headers.origin !== `http://localhost:${address.port}`
typeof req.headers.origin === 'string' &&
!req.headers.origin.match(/^https?:\/\/localhost:/)
) {
next(
new Error(
Expand Down

0 comments on commit 9a5062c

Please sign in to comment.