New — Iris AI drafts your firewall, routing & rate-limit rules. Explore AI features →
Back to Blog
tutorialgatewaysecurityapi-gatewaytunneling

Building an Edge Gateway: From Zero to Production

A practical guide to setting up a production-grade edge gateway with WAF, per-endpoint auth, load balancing, and multi-region deployment in under an hour.

3 min read

Setting up a production-grade edge gateway used to mean configuring Nginx, managing SSL certificates, setting up a WAF, wiring up authentication, configuring DNS records, and monitoring it all. It was a multi-day project for each new service.

With Ngris, you can go from zero to a fully configured production edge gateway in under an hour. Here's how.

Step 1: Install and Connect

# Install Ngris

curl -sSL https://ngris.com/install.sh | sh

# Expose your local server

ngris http 3000

That's it. Your local server is now accessible via a public URL with TLS termination. But that's just the start.

Step 2: Add a Custom Domain

In the Ngris dashboard, navigate to your endpoint and add a custom domain. Ngris automatically provisions DNS records and TLS certificates via Let's Encrypt. No manual certificate management.

The custom domains guide walks through each step.

Step 3: Enable the WAF

Ngris includes a traffic-policy engine with 23 rule types across four phases — among them a built-in, Coraza-powered Web Application Firewall. Enable it with one click in the dashboard, or from the agent when the tunnel starts:

# WAF and other rules from a policy file

ngris http 3000 --traffic-policy ./policy.yaml

# Rate limiting per client IP

ngris http 3000 --rate-limit 100/1m

The default ruleset covers: SQL injection, XSS, path traversal, command injection, HTTP method filtering, bot detection, and more. You can also use AI-powered analysis to generate custom rules based on your traffic patterns.

Step 4: Configure Authentication

Per-endpoint access control is built in. Choose from multiple auth methods:

Basic Auth

Username/password with bcrypt hashing. Set up in seconds.

OAuth Providers

Google, GitHub, or any OIDC provider (Okta, Entra ID, Auth0) for team and enterprise auth.

API Keys

Token-based auth for API endpoints with per-key permissions.

IP Allowlist

Restrict access to specific IP ranges or CIDR blocks.

Step 5: Set Up Traffic Policies

Traffic policies let you control how requests flow through your gateway:

  • Rate limiting — per-IP, per-endpoint, or global
  • Request transformation — add/remove headers, rewrite paths
  • Circuit breakers — fail fast when your backend is struggling
  • Geographic blocking — allow or deny by country
  • Load balancing — distribute across multiple agents

Step 6: Multi-Agent Load Balancing & Routing

For production workloads, you can connect multiple agents to the same endpoint. Ngris automatically load-balances traffic across them using configurable strategies (round-robin, least connections, geographic).

Need more control? Routing rules let you direct specific requests to a particular agent based on path, header, cookie, client IP, or HTTP method. This enables blue/green canary deployments, path-based routing (e.g. /api/* to one agent, /web/* to another), and team-specific backends — all from a single hostname.

# On server 1

ngris http 3000 --url api.yourcompany.com

# On server 2

ngris http 3000 --url api.yourcompany.com

# Traffic is now load-balanced between both

Step 7: Monitor and Respond

Every request is logged with full metadata. The traffic inspector shows request/response details in real-time. Anomaly detection alerts you to unusual patterns. And the built-in helpdesk system handles support tickets from your users.

What You Get in Under an Hour

  • Custom domain with auto-renewed TLS certificates
  • A traffic-policy engine with 23 rule types, including a Coraza WAF for OWASP-style attacks
  • Per-endpoint authentication with OAuth providers
  • Traffic policies with rate limiting and geo-blocking
  • Multi-agent load balancing for high availability
  • Real-time traffic inspection and anomaly detection
  • Full audit logging for compliance

Start building your production edge gateway today — create a free account and run your first tunnel in 30 seconds.

Ask an AI to summarise this page
Deploy
App hosting Edge functions Domains & certificates
Connect
Secure tunnels API gateway Multi-region edge
Protect
Bot protection & challenge WAF & firewall Edge login
Observe & AI
Monitoring Inspector & replay Iris AI MCP server AI Gateway
Developers
Developer tools Docs ngrok policy converter
Compare
Ngris vs ngrok Ngris vs Cloudflare Tunnel Ngris vs Vercel Ngris vs Netlify Expose localhost guide
More
Solutions Pricing Enterprise Sign in Get Started Free