Separate the browser-facing origin from the dev server's bind address - #658
Merged
Conversation
tricknotes
force-pushed
the
dev-server-asset-helpers
branch
from
September 4, 2026 08:09
48d7fc9 to
fe2a21b
Compare
The dev_server `host` option served three purposes at once: the address the development server binds to, the address Rails connects to it on, and the origin the browser loads the application's assets from. In a container those purposes conflict: the server must bind to `0.0.0.0` to be reachable through the container's published port, but browsers refuse to connect to `http://0.0.0.0`, so every asset request from the page fails. Add an `origin` option naming the browser-facing origin independently of `host`. `DevServer#origin` honors it, which covers both the `index.html` rewriting in `Deploy::DevServer` and the startup tags emitted by ember-cli-rails-assets 0.9.0 (it reads `dev_server.origin`), so no change is needed on the assets side. Rails' own connections (`request` and `listening?`) now use the bind address rather than the origin, with `0.0.0.0` mapped to the loopback interface, since the unspecified address asks the server to listen everywhere but is not an address to connect to. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
tricknotes
force-pushed
the
dev-server-origin
branch
from
September 4, 2026 08:09
81d76a8 to
538f186
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
dev_serverhostoption currently serves three purposes at once: the address the development server binds to, the address Rails connects to it on, and the origin the browser loads the application's assets from.In a container those purposes conflict. The server must bind to
0.0.0.0to be reachable through the container's published port, but a page then refers to its assets ashttp://0.0.0.0:4200/..., and browsers refuse to connect to0.0.0.0(Chrome blocks it under Local Network Access), so every asset request fails. Verified against a real application running under Docker Compose, with the browser on the host.This PR splits the three purposes:
originoption todev_server, naming the browser-facing origin independently ofhost(e.g.dev_server: { host: "0.0.0.0", port: 4200, origin: "http://localhost:4200" }). A trailing slash is stripped. It defaults tohttp://<host>:<port>, as before.DevServer#originhonors it, which covers both theindex.htmlrewriting inDeploy::DevServerand the startup tags emitted by ember-cli-rails-assets 0.9.0 (the helper readsdev_server.origin), so no change is needed on the assets side.request/listening?) now use the bind address instead of the origin, with0.0.0.0mapped to the loopback interface — the unspecified address asks the server to listen on every interface, but is not an address to connect to.Also documents the container setup in the README and UPGRADING, and adds a CHANGELOG entry under the unreleased section.
Verified with the setup above (
host: "0.0.0.0",port: 4200, published as4200:4200,origin: "http://localhost:4200"): assets load and HMR works.Notes
dev-server-asset-helpers(Document asset helpers serving from the development server #654), since the assets-helper path is one of the consumers ofdev_server.origin.