briqbriq

Nginx gateway

A gateway (reverse proxy): one URL for several briqs of a stack, routed by path (/api/ to the back end, / to the front end). One origin for the browser, nothing to change in the apps.

  • app
  • proxy

Guide: Run a GitHub repo

Run it

briq_run({
  recipe: "nginx",
  params: {
    "routes": {
      "/": "app:8080"
    },
    "size": "nano"
  },
  wait: true
})

Parameters

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

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

Let your agent try it, on us.

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

Connect your agent

How can we help?

Message to the briq team
hello@briq.cloud