mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/47876 Currently, if a device is connected to the bundler via, say, `http://10.0.2.2:8081` (Android default), and a debugger is opened on `http://localhost:8081`, we rewrite hostnames `10.0.2.2.`<->`localhost` so that URLs are correct relative to each. However, if the debugger is on a different port or protocol, this breaks down - because we only rewrite hostnames. This fixes that by using the debugger's connecting `Host` header and `encrypted` state to derive the base URL of the server relative to the frontend. We then update the rewriting logic to use this actual full origin (protocol + host) in place of the device-relative origin. Changelog: [General][Fixed] dev-middleware: Fix URL rewriting where device and debugger reach the server on different ports/protocols. Reviewed By: huntie Differential Revision: D66077627 fbshipit-source-id: 01f6565149caa34b1e9e50dd58deb0122485657c