Nginx gateway

Route requests to multiple services through one URL with nginx.

  • app
  • proxy

Guide: Run a GitHub repo

Run it

briq run nginx

Fields

NameTypeOptionsDefault
routesrecord{ "/prefix/": "briq:port" }{"/":"app:8080"}
sizeenumnano, small"nano"
egressobject{ hosts }—

Outputs

Returned by briq_run once the stack is healthy. Hosts resolve inside your team network; secrets are generated per run.

GATEWAY_URL
http://gateway.<stack>.internal

What it runs

BriqImagePortsSizeVolume
gatewaynginx:1-alpine80nano—

When to use it

  • An app in several briqs (front end, back end, database), opened at one URL.
  • A front end that calls its API at /api/…: one origin, so no CORS and no API address to build in.

Tips

  • Run it last: it reads the addresses of the briqs it routes to, and waits for them to run.
  • Routes are path prefixes: { "/api/": "backend:8000", "/": "frontend:8080" }. The longest wins, and the path is passed on whole.
  • End a prefix with / to match a folder only: /docs also takes /docs-old.
  • Name the briqs behind it: run them with name: "backend" and name: "frontend".
  • Expose only the gateway: the briqs behind it stay private. Its URL is gateway-….
  • Listen on :: behind it: it reaches them over the private network, which is IPv6.
  • A 502 for a few seconds means a briq behind it is still starting, after a wake for example.
  • Host, X-Forwarded-Host and WebSockets go through.
  • Step by step: Run a GitHub repo.

On this page

Free to try

Try briq, on us.

Every new account starts with €10 of credits. No card.

Start building

How can we help?

Message to the briq team