react-native/packages
Rob Hogan 69400be4fc dev-middleware: Only rewrite hostnames if they match device connection hosts (#47685)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47685

Currently, we assume any URL with a hostname of `10.0.2.2` or `10.0.3.2` (device-relative) is eligible for rewriting to `localhost` (frontend-relative), because we assume the device is an Android emulator. We rewrite these URLs between device and dev machine so that the rewritten URLs are reachable from the dev machine.

This diff narrows this logic so that we'll only rewrite URLs where the hostname matches the pre-existing list *and* this matches the host the device is actually connected on, according to its headers from the original connection.

The main motivation for this change is to unblock removing assumptions about device-reachable vs server-reachable hosts. Later in the stack we'll drop the hardcoded listing of `10.0.2.2` etc in favour of identifying URLs that target the dev server, from whatever network.

There's also an edge case fix here that `10.0.2.2` etc might actually refer to a remote LAN server, and not be an Android emulator's alias for for an emulator host.

Changelog:
[General][Fixed] RN DevTools: Don't assume 10.0.2.2 is an alias for localhost unless it's used to establish a connection to the server

Reviewed By: huntie

Differential Revision: D66058704

fbshipit-source-id: bad28717b0c9b1ca43e2ea3391cef13f87892e6c
2024-11-20 06:56:21 -08:00
..
assets replace '$TEMPORARY$string<>' with 'string' (#46876) 2024-10-07 19:18:14 -07:00
babel-plugin-codegen RN: Fix lint/sort-imports Errors (#47109) 2024-10-18 04:07:02 -07:00
community-cli-plugin fix/cli start (#47450) 2024-11-06 07:26:30 -08:00
core-cli-utils Bump main to 0.77 2024-09-12 09:23:23 -07:00
debugger-frontend Update debugger-frontend from ff343d8...b61aae3 (#47593) 2024-11-13 11:27:38 -08:00
dev-middleware dev-middleware: Only rewrite hostnames if they match device connection hosts (#47685) 2024-11-20 06:56:21 -08:00
eslint-config-react-native Revert to @babel/eslint-parser in eslint-config (#47333) 2024-11-01 05:31:37 -07:00
eslint-plugin-react-native Update hermes-parser and related packages in fbsource to 0.24.0 (#46802) 2024-10-03 08:20:16 -07:00
eslint-plugin-specs Update hermes-parser and related packages in fbsource to 0.24.0 (#46802) 2024-10-03 08:20:16 -07:00
gradle-plugin RNGP - Do not attempt to substring to 1024 while logging. (#47509) 2024-11-08 04:57:15 -08:00
helloworld Pass the RCTAppDependencyProvider to the RCTAppDelegate (#47651) 2024-11-18 08:06:13 -08:00
hermes-inspector-msggen Bump main to 0.77 2024-09-12 09:23:23 -07:00
metro-config metro-config: Revert setting hermesParser: true in default Metro config (#47670) 2024-11-19 02:43:03 -08:00
normalize-color Bump main to 0.77 2024-09-12 09:23:23 -07:00
polyfills Implement always available js error handling (#47466) 2024-11-07 11:22:57 -08:00
react-native Add missing Android-only props to ImageProps (#47719) 2024-11-20 06:34:35 -08:00
react-native-babel-preset Update hermes-parser and related packages in fbsource to 0.24.0 (#46802) 2024-10-03 08:20:16 -07:00
react-native-babel-transformer Update hermes-parser and related packages in fbsource to 0.24.0 (#46802) 2024-10-03 08:20:16 -07:00
react-native-bots fix: mitigate DangerJS transpilation bug (#47192) 2024-10-24 20:07:20 -07:00
react-native-codegen feat: handle negative values in enums (#47452) 2024-11-13 12:20:16 -08:00
react-native-codegen-typescript-test Bump main to 0.77 2024-09-12 09:23:23 -07:00
react-native-info Bump main to 0.77 2024-09-12 09:23:23 -07:00
react-native-popup-menu-android Convert com.facebook.react.ViewManagerOnDemandReactPackage to Kotlin (#47682) 2024-11-20 04:05:26 -08:00
react-native-test-library Let lib maintainer be explicit with componentProvider mapping (#47520) 2024-11-12 07:38:03 -08:00
react-native-test-renderer Refactor Performance and PerformanceObserver internals (#46693) 2024-10-02 03:13:24 -07:00
rn-tester Disable flaky flatList test (#47718) 2024-11-19 09:23:20 -08:00
typescript-config Bump main to 0.77 2024-09-12 09:23:23 -07:00
virtualized-lists RN: Feature Flag to Disable InteractionManager in Batchinator (#47690) 2024-11-18 23:12:15 -08:00