Documentation
Reverse proxy and local DNS
Expose local web and API processes through HTTPS hostnames.
Use this pattern when your project already starts web/API processes locally and you want stable HTTPS hostnames in front of them.
nginx implicitly enables certificates. Add dnsmasq when you want local DNS resolution for the configured hostnames.
schema_version = 1
tld = "local.dev.test"
enabled = ["dnsmasq", "nginx"]
[nginx]
https_port = 54443
[[nginx.server]]
server_names = ["app.local.dev.test"]
link = { label = "App", path = "/" }
upstreams = { web = "http://127.0.0.1:3000", api = "http://127.0.0.1:4000" }
[[nginx.server.route]]
match = { prefix = "/api/ws" }
to = { upstream = "api", websocket = true }
[[nginx.server.route]]
match = { prefix = "/api/" }
to = { upstream = "api" }
[[nginx.server.route]]
match = { prefix = "/" }
to = { upstream = "web", websocket = true }
[[nginx.server]]
server_names = ["admin.local.dev.test"]
link = { label = "Admin", path = "/" }
upstreams = { web = "http://127.0.0.1:3001", api = "http://127.0.0.1:4001" }
[[nginx.server.route]]
match = { prefix = "/api/" }
to = { upstream = "api" }
[[nginx.server.route]]
match = { prefix = "/" }
to = { upstream = "web", websocket = true }What to customize
tldandserver_names: choose a domain reserved for your local workspace.https_port: keep a non-privileged port such as54443unless you deliberately want port443.upstreams: point to the ports used by your app processes.websocket = true: keep it for dev servers, HMR, or WebSocket APIs.
Related reference
See [nginx], [[nginx.server]], and [[nginx.server]].route.