-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add serverBaseUrl option, set client-accessible URL value externally #39456
Conversation
This pull request was exported from Phabricator. Differential Revision: D49276125 |
…acebook#39456) Summary: **Fixes new debugger launch flow on Android:** D49158227 aimed to improve proxy-safe behaviour for remote dev servers by auto-detecting the appropriate server URL for clients using the `Host` header (etc) from the HTTP request. However, this approach broke the local case for Android emulators and externally connected devices since they would originate from a device-relative server hostname — e.g. `10.0.2.2` for the stock Android emulator. https://pxl.cl/3mVmR This commit reverts to an explicit approach where callers specify the base URL to the dev server that should be addressible from the development machine — now as a single `serverBaseUrl` option. **Changes** - Adds new `serverBaseUrl` option to `createDevMiddleware`, designed to be the base URL value for constructing dev server URLs returned in endpoints such as `/json/list`. - This changes little for the `localhost` case (now enabling `https://` URLs), but enables remote dev server setups to specify this cleanly. - Updates call site in `community-cli-plugin`. Changelog: [Internal] Differential Revision: D49276125
312c446
to
02aaaea
Compare
This pull request was exported from Phabricator. Differential Revision: D49276125 |
Base commit: 88395bb |
This pull request was exported from Phabricator. Differential Revision: D49276125 |
…acebook#39456) Summary: **Fixes new debugger launch flow on Android:** D49158227 aimed to improve proxy-safe behaviour for remote dev servers by auto-detecting the appropriate server URL for clients using the `Host` header (etc) from the HTTP request. However, this approach broke the local case for Android emulators and externally connected devices since they would originate from a device-relative server hostname — e.g. `10.0.2.2` for the stock Android emulator. https://pxl.cl/3mVmR This commit reverts to an explicit approach where callers specify the base URL to the dev server that should be addressible from the development machine — now as a single `serverBaseUrl` option. **Changes** - Adds new `serverBaseUrl` option to `createDevMiddleware`, designed to be the base URL value for constructing dev server URLs returned in endpoints such as `/json/list`. - This changes little for the `localhost` case (now enabling `https://` URLs), but enables remote dev server setups to specify this cleanly. - Updates call site in `community-cli-plugin`. Changelog: [Internal] Reviewed By: robhogan Differential Revision: D49276125
02aaaea
to
e791650
Compare
…acebook#39456) Summary: **Fixes new debugger launch flow on Android:** D49158227 aimed to improve proxy-safe behaviour for remote dev servers by auto-detecting the appropriate server URL for clients using the `Host` header (etc) from the HTTP request. However, this approach broke the local case for Android emulators and externally connected devices since they would originate from a device-relative server hostname — e.g. `10.0.2.2` for the stock Android emulator. https://pxl.cl/3mVmR This commit reverts to an explicit approach where callers specify the base URL to the dev server that should be addressible from the development machine — now as a single `serverBaseUrl` option. **Changes** - Adds new `serverBaseUrl` option to `createDevMiddleware`, designed to be the base URL value for constructing dev server URLs returned in endpoints such as `/json/list`. - This changes little for the `localhost` case (now enabling `https://` URLs), but enables remote dev server setups to specify this cleanly. - Updates call site in `community-cli-plugin`. Changelog: [Internal] Reviewed By: robhogan Differential Revision: D49276125
e791650
to
4435d77
Compare
This pull request was exported from Phabricator. Differential Revision: D49276125 |
…acebook#39456) Summary: **Fixes new debugger launch flow on Android:** D49158227 aimed to improve proxy-safe behaviour for remote dev servers by auto-detecting the appropriate server URL for clients using the `Host` header (etc) from the HTTP request. However, this approach broke the local case for Android emulators and externally connected devices since they would originate from a device-relative server hostname — e.g. `10.0.2.2` for the stock Android emulator. https://pxl.cl/3mVmR This commit reverts to an explicit approach where callers specify the base URL to the dev server that should be addressible from the development machine — now as a single `serverBaseUrl` option. **Changes** - Adds new `serverBaseUrl` option to `createDevMiddleware`, designed to be the base URL value for constructing dev server URLs returned in endpoints such as `/json/list`. - This changes little for the `localhost` case (now enabling `https://` URLs), but enables remote dev server setups to specify this cleanly. - Updates call site in `community-cli-plugin`. Changelog: [Internal] Reviewed By: robhogan Differential Revision: D49276125
This pull request was exported from Phabricator. Differential Revision: D49276125 |
4435d77
to
d48c8b9
Compare
…acebook#39456) Summary: **Fixes new debugger launch flow on Android:** D49158227 aimed to improve proxy-safe behaviour for remote dev servers by auto-detecting the appropriate server URL for clients using the `Host` header (etc) from the HTTP request. However, this approach broke the local case for Android emulators and externally connected devices since they would originate from a device-relative server hostname — e.g. `10.0.2.2` for the stock Android emulator. https://pxl.cl/3mVmR This commit reverts to an explicit approach where callers specify the base URL to the dev server that should be addressible from the development machine — now as a single `serverBaseUrl` option. **Changes** - Adds new `serverBaseUrl` option to `createDevMiddleware`, designed to be the base URL value for constructing dev server URLs returned in endpoints such as `/json/list`. - This changes little for the `localhost` case (now enabling `https://` URLs), but enables remote dev server setups to specify this cleanly. - Updates call site in `community-cli-plugin`. Changelog: [Internal] Reviewed By: robhogan Differential Revision: D49276125
d48c8b9
to
4bb3222
Compare
This pull request was exported from Phabricator. Differential Revision: D49276125 |
…acebook#39456) Summary: **Fixes new debugger launch flow on Android:** D49158227 aimed to improve proxy-safe behaviour for remote dev servers by auto-detecting the appropriate server URL for clients using the `Host` header (etc) from the HTTP request. However, this approach broke the local case for Android emulators and externally connected devices since they would originate from a device-relative server hostname — e.g. `10.0.2.2` for the stock Android emulator. https://pxl.cl/3mVmR This commit reverts to an explicit approach where callers specify the base URL to the dev server that should be addressible from the development machine — now as a single `serverBaseUrl` option. **Changes** - Adds new `serverBaseUrl` option to `createDevMiddleware`, designed to be the base URL value for constructing dev server URLs returned in endpoints such as `/json/list`. - This changes little for the `localhost` case (now enabling `https://` URLs), but enables remote dev server setups to specify this cleanly. - Updates call site in `community-cli-plugin`. Changelog: [Internal] Reviewed By: robhogan Differential Revision: D49276125
4bb3222
to
1d06f38
Compare
This pull request was exported from Phabricator. Differential Revision: D49276125 |
This pull request was successfully merged by @huntie in 850e550. When will my fix make it into a release? | Upcoming Releases |
…ist' by requestor Summary: `serverBaseUrl` is currently documented as: > The base URL to the dev server, as addressible from the local developer machine This is problematic in general because `dev-middleware` on a server doesn't necessarily know about where clients might be reaching it from, how tunnels or port-forwards are set up, etc., and this can change over the lifetime of the server and vary between clients. Indeed, our own use of `serverBaseUrl` from both `community-cli-plugin` and internally simply sets it to the host and port the dev server is listening on - ie it's the address of the dev server accessible *from the server*. This PR changes the docs, redefining `serverBaseUrl`, to match the way we currently specify it. One usage where we *do* want the previously documented behaviour is in responses to `/json/list` (`getPageDescriptions`) where the URLs in the response should be reachable by a browser requesting `/json/list`. Here, we use the request (host header, etc.) to attempt to get working base URL. History: It should be mentioned that this is the latest in a series of changes like this: - #39394 - #39456 Learning from those: - This change does *not* break Android emulators, which routes `10.0.2.2` to localhost, or other routed devices, because `/open-debugger` still uses server-relative URLs, and now formally delegates to `BrowserLauncher` to decide what to do with those URLs (internally, VSCode / `xdg-open` handles port forwarding) - Middleware configuration is no longer required to specify how it is reachable from clients. This sets up some subsequent changes for more robust handling of tunnelled connections. Changelog: [General][Breaking] dev-middleware: Frameworks should specify `serverBaseUrl` relative to the middleware host. Differential Revision: D65974487
…ist' by requestor (#47628) Summary: `serverBaseUrl` is currently documented as: > The base URL to the dev server, as addressible from the local developer machine This is problematic in general because `dev-middleware` on a server doesn't necessarily know about where clients might be reaching it from, how tunnels or port-forwards are set up, etc., and this can change over the lifetime of the server and vary between clients. Indeed, our own use of `serverBaseUrl` from both `community-cli-plugin` and internally simply sets it to the host and port the dev server is listening on - ie it's the address of the dev server accessible *from the server*. This PR changes the docs, redefining `serverBaseUrl`, to match the way we currently specify it. One usage where we *do* want the previously documented behaviour is in responses to `/json/list` (`getPageDescriptions`) where the URLs in the response should be reachable by a browser requesting `/json/list`. Here, we use the request (host header, etc.) to attempt to get working base URL. History: It should be mentioned that this is the latest in a series of changes like this: - #39394 - #39456 Learning from those: - This change does *not* break Android emulators, which routes `10.0.2.2` to localhost, or other routed devices, because `/open-debugger` still uses server-relative URLs, and now formally delegates to `BrowserLauncher` to decide what to do with those URLs (internally, VSCode / `xdg-open` handles port forwarding) - Middleware configuration is no longer required to specify how it is reachable from clients. This sets up some subsequent changes for more robust handling of tunnelled connections. Changelog: [General][Breaking] dev-middleware: Frameworks should specify `serverBaseUrl` relative to the middleware host. Differential Revision: D65974487
…ist' by requestor (#47628) Summary: Pull Request resolved: #47628 `serverBaseUrl` is currently documented as: > The base URL to the dev server, as addressible from the local developer machine This is problematic in general because `dev-middleware` on a server doesn't necessarily know about where clients might be reaching it from, how tunnels or port-forwards are set up, etc., and this can change over the lifetime of the server and vary between clients. Indeed, our own use of `serverBaseUrl` from both `community-cli-plugin` and internally simply sets it to the host and port the dev server is listening on - ie it's the address of the dev server accessible *from the server*. This PR changes the docs, redefining `serverBaseUrl`, to match the way we currently specify it. One usage where we *do* want the previously documented behaviour is in responses to `/json/list` (`getPageDescriptions`) where the URLs in the response should be reachable by a browser requesting `/json/list`. Here, we use the request (host header, etc.) to attempt to get working base URL. History: It should be mentioned that this is the latest in a series of changes like this: - #39394 - #39456 Learning from those: - This change does *not* break Android emulators, which routes `10.0.2.2` to localhost, or other routed devices, because `/open-debugger` still uses server-relative URLs, and now formally delegates to `BrowserLauncher` to decide what to do with those URLs (internally, VSCode / `xdg-open` handles port forwarding) - Middleware configuration is no longer required to specify how it is reachable from clients. This sets up some subsequent changes for more robust handling of tunnelled connections. Changelog: [General][Breaking] dev-middleware: Frameworks should specify `serverBaseUrl` relative to the middleware host. Reviewed By: huntie Differential Revision: D65974487 fbshipit-source-id: 1face8fc7715df387f75b329e80932d8543ee419
Summary:
Fixes new debugger launch flow on Android:
D49158227 (#39394) aimed to improve proxy-safe behaviour for remote dev servers by auto-detecting the appropriate server URL for clients using the
Host
header (etc) from the HTTP request. However, this approach broke the local case for Android emulators and externally connected devices since they would originate from a device-relative server hostname — e.g.10.0.2.2
for the stock Android emulator.This commit reverts to an explicit approach where callers specify the base URL to the dev server that should be addressible from the development machine — now as a single
serverBaseUrl
option.Changes
serverBaseUrl
option tocreateDevMiddleware
, designed to be the base URL value for constructing dev server URLs returned in endpoints such as/json/list
.localhost
case (now enablinghttps://
URLs), but enables remote dev server setups to specify this cleanly.community-cli-plugin
.Changelog: [Internal]
Differential Revision: D49276125