Share localhost / Phoenix
Share a Phoenix dev server at a public URL
mix phx.server listens on 127.0.0.1:4000, and whk share 4000 gives it an HTTPS link. LiveView, channels and live reload all use WebSockets on that one port, so they come along.
# terminal 1: the dev server
mix phx.server
# terminal 2: the link
whk share 4000The link is https://<name>.sharehooks.cc and works until you press Ctrl-C. No whk yet? Install it and log in, which takes a minute.
Phoenix at a glance
- Dev server
mix phx.server, port 4000- Share it
whk share 4000- Setting to add
- None. A generated app sets
check_origin: falseinconfig/dev.exs, and with the check on, the link sends a socket'sOriginashttp://localhost:4000, which matches the endpoint's host. - Without it
- Nothing to hit through
whk share. With another tunnel and the check on, sockets get403and the log saysCould not check origin for Phoenix.Socket transport. - Hot reload
- Yes.
Phoenix.LiveReloaderconnects to the browser's own host and port, so open tabs reload when matching files change. - URLs and cookies
- Path helpers (
~p) are relative and work as they are. Full URLs come from the endpoint's:urlconfig,localhostby default. Forms use session tokens with no host comparison.
Your dev server gets each request with Host: localhost:4000; the public name travels in X-Forwarded-Host, with X-Forwarded-Proto: https. What your server sees has the rest.
Sockets and check_origin
Phoenix checks the Origin header of socket connections against the host in the endpoint's :url config. A generated app turns that off for development with check_origin: false in config/dev.exs, so LiveView at /live and your channels connect through a share as they are.
If your project has the check on in development, it still passes: the link sends a WebSocket's Origin as your local origin, http://localhost:4000, and with check_origin: true Phoenix compares only the host, localhost, which is the default :url host. The failure you may have met with other tunnels is a 403 on the socket and a log entry beginning Could not check origin for Phoenix.Socket transport.; its fix is an explicit list:
config/dev.exs
# Only for a proxy that passes the public Origin on
config :my_app, MyAppWeb.Endpoint,
check_origin: ["//localhost", "//*.sharehooks.cc"]Live reload comes through
In development the endpoint serves Phoenix.LiveReloader's socket at /phoenix/live_reload/socket, on the same port as the app. By default the reloader's script connects to the browser's host and port, which on a shared page is the link. When a file matching your live_reload patterns changes, a visitor's tab reloads like your own.
Code changes are picked up by Phoenix.CodeReloader on the next request, as usual.
URLs, forms and the listening address
Verified routes written with ~p produce paths, so links and form actions are the same on localhost and on the link. Functions that return full URLs use the endpoint's :url config, which is [host: "localhost"] in a generated app, so url(~p"/") says localhost. Set :url for the session if an email or a callback needs the public address; a reserved name keeps that address stable.
Form protection is Plug.CSRFProtection: a token in the session compared with the one sent. No host is involved for forms posted to a path, so they work through the link.
A generated app binds 127.0.0.1 in development, and the port comes from the PORT environment variable, 4000 when unset. whk share 4000 connects to the loopback address, so the binding needs no change.
Phoenix questions
Yes. LiveView's socket at /live is a WebSocket on the app's own port, and WebSockets pass through whk share. A generated app has check_origin: false in development; with the check on, the socket's Origin arrives as localhost and matches.
That log entry means a socket's Origin host differs from the endpoint's configured host. Either set url: [host: ...] to the host you are using, or pass check_origin a list of allowed origins such as ["//*.example.com"]. Through whk share the Origin is sent as your local origin, so the default configuration passes.
Yes. The live reload socket is served by the same endpoint and port, and its script connects to the host the page was loaded from, so visitors' tabs reload when you change a watched file.
4000 by default, or the PORT environment variable. Share the port mix phx.server prints.
Sources
The Phoenix settings and messages on this page are from the official documentation and source for Phoenix 1.8, read on 12 November 2026. What the link does to a request is from the whk share docs.
Other frameworks
Send someone your Phoenix app
Sign up free, install the CLI and run whk share 4000.
No credit card