All posts

The simplest way to make HAProxy Kong work like it should

You can tell a good network setup by how little anyone talks about it. No one praises an API gateway when traffic flows cleanly at 3 a.m., but everyone notices when certificates expire or retries vanish into the void. Getting HAProxy and Kong to play nicely is how you build that kind of unnoticed reliability. HAProxy brings raw control. It’s a fast, battle-tested load balancer used everywhere from trading floors to home labs. Kong sits farther up the stack as an API gateway, enforcing identity,

Free White Paper

End-to-End Encryption + Sarbanes-Oxley (SOX) IT Controls: The Complete Guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free. No spam. Unsubscribe anytime.

You can tell a good network setup by how little anyone talks about it. No one praises an API gateway when traffic flows cleanly at 3 a.m., but everyone notices when certificates expire or retries vanish into the void. Getting HAProxy and Kong to play nicely is how you build that kind of unnoticed reliability.

HAProxy brings raw control. It’s a fast, battle-tested load balancer used everywhere from trading floors to home labs. Kong sits farther up the stack as an API gateway, enforcing identity, rate limits, and service policies. When you pair them, HAProxy handles edge-level routing and TLS, while Kong governs the internal conversation between clients and microservices. Together they turn sprawl into order.

The workflow is straightforward. HAProxy receives external requests, authenticates at the edge, and sends traffic only to Kong’s known upstream routes. Kong applies its plug-in logic—OIDC via Okta, JWT verification, RBAC checks, or custom Lua filters—and passes along only what meets policy. Logs flow back through HAProxy to your central observability system, so every request has a traceable lineage.

Featured snippet answer:
To integrate HAProxy and Kong, run HAProxy as the public entry point handling inbound load and SSL termination, and configure its backends to forward traffic to Kong’s proxy ports. Kong then enforces identity, quotas, and routing rules before delivering requests to internal services. The result is a secure, layered API gateway pattern that scales cleanly.

Common fine‑tuning comes next. Set short keep‑alive timeouts on HAProxy if Kong runs behind autoscaling groups, otherwise stale connections linger. Use consistent header propagation so Kong can map the original client identity for auditing. Rotate API keys and OIDC secrets automatically, and store them in a vault accessible by both services under IAM roles, not static tokens.

Continue reading? Get the full guide.

End-to-End Encryption + Sarbanes-Oxley (SOX) IT Controls: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

Benefits of combining HAProxy and Kong

  • Faster response paths through efficient load distribution
  • Centralized security enforcement without reinventing rate limit logic
  • Simpler audits: every request tied to a verified identity
  • Easier rollouts with blue‑green or canary routing handled at the load balancer
  • Lower mean time to recovery because logs tell the full story

For developers, this setup reduces toil. They deploy once and trust the gateway layer to handle access and observability. Debugging drops from “who approved this token?” to a single trace ID. Approvals stop blocking releases because policy lives in config, not chat threads.

Platforms like hoop.dev turn those access rules into guardrails that enforce policy automatically. Instead of writing brittle scripts to sync HAProxy ACLs with Kong consumers, you define intent once. The platform keeps both layers aligned and identity‑aware in real time.

How do I connect HAProxy with Kong for OIDC authentication?
Kong provides an OIDC plugin that validates ID tokens from providers such as Okta or AWS Cognito. Configure HAProxy to forward the Authorization header untouched, and let Kong verify credentials at the service layer. This keeps your edge thin and your authentication centralized.

When should I prefer HAProxy Kong integration over using Kong alone?
Use both when you need extreme performance at the perimeter or advanced routing strategies. HAProxy excels at edge speed and reliability, while Kong shines in policy and plugin extensibility. The combination gives you strict control without adding latency.

HAProxy Kong integration is about building trust between layers: speed at the front, intelligence inside.

See an Environment Agnostic Identity-Aware Proxy in action with hoop.dev. Deploy it, connect your identity provider, and watch it protect your endpoints everywhere—live in minutes.

Get started

See hoop.dev in action

One gateway for every database, container, and AI agent. Deploy in minutes.

Get a demoMore posts