mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
b55a871fa6
Summary: 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. Differential Revision: D66077627