Repository navigation
Conversation
parndt
force-pushed
the
bind-dev-server-to-localhost
branch
from
November 24, 2026 03:45
ed02e8f to
c9f9d34
Compare
parndt
force-pushed
the
bind-dev-server-to-localhost
branch
3 times, most recently
from
November 24, 2026 04:00
82195b5 to
2638d12
Compare
The generated config/puma.rb calls `port` without a host, so Puma listens on every interface. In development that exposes the app, and anything mounted for local use only, to every other machine on the same network, such as office, café, or conference Wi-Fi. Bind to localhost in development instead, which Puma resolves to every loopback address (127.0.0.1 and ::1), and leave other environments binding all interfaces as before. HANAMI_HOST overrides the host for cases that need a wider bind, like a dev server inside a container. `hanami server --host` still takes precedence over the config file. The environment is read the same way Hanami reads it, from HANAMI_ENV, then APP_ENV, and then RACK_ENV, so an app deployed with only RACK_ENV set to production keeps listening on all interfaces rather than becoming unreachable. An empty HANAMI_HOST is treated as unset, since Puma reads an empty host as 0.0.0.0, which would quietly undo the localhost bind when a variable is passed through without a value.
parndt
force-pushed
the
bind-dev-server-to-localhost
branch
from
November 24, 2026 04:01
2638d12 to
77d190c
Compare
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.
The
config/puma.rbgenerated byhanami newcallsportwithout a host, so Puma listens on every interface. In development this makes the app, along with anything mounted for local use only, reachable from every other machine on the same network, such as office, café, or conference Wi-Fi.This binds to localhost in development, which Puma resolves to both
127.0.0.1and::1. Other environments keep binding all interfaces as before. SettingHANAMI_HOSTwidens the bind for setups that need it, like running the dev server inside a container, andhanami server --hoststill takes precedence over the config file.