Files
Rob Hogan b55a871fa6 dev-middleware: Don't assume device-relative and debugger-relative URLs have the same port - remove CORS reliance
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
2024-11-21 07:10:15 -08:00
..
2024-09-12 09:23:23 -07:00
2024-09-12 09:23:23 -07:00
2024-09-12 09:23:23 -07:00
2024-09-12 09:23:23 -07:00
2024-09-12 09:23:23 -07:00