// use case

Expose your NestJS API publicly

NestJS sits on top of Express or Fastify. The localhost limitation is the same — webhooks, OAuth callbacks, mobile clients all need https. lrok adds the public layer without changing your nest start command.
  1. Run Nest

    $ npm run start:dev
  2. Tunnel

    $ lrok http 3000
  3. Enable trust-proxy on the underlying server

    In main.ts: const app = await NestFactory.create<NestExpressApplication>(AppModule); app.set('trust proxy', true). Fastify users: { trustProxy: true } in the adapter.

// why lrok for this

Nest's Throttler / RateLimiter modules read req.ip; without trust-proxy every request looks like 127.0.0.1 and rate limits never trip. lrok forwards X-Forwarded-For; trust-proxy unwraps it.

Related workflows