The Simplest Way to Make Gerrit and Traefik Work Like They Should
Pairing Gerrit and Traefik routes web and Git traffic to your code review server. This setup handles certificates, forwards network ports, and manages user login flows. Gerrit manages code reviews and Git repos for your software team. Traefik sits at the network edge and directs incoming requests to backend services. When you run both tools together, developers get a clean URL for code changes. Meanwhile, your ops team gets one place to manage TLS certificates and network rules. How Gerrit an
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Pairing Gerrit and Traefik routes web and Git traffic to your code review server. This setup handles certificates, forwards network ports, and manages user login flows.
Gerrit manages code reviews and Git repos for your software team. Traefik sits at the network edge and directs incoming requests to backend services. When you run both tools together, developers get a clean URL for code changes. Meanwhile, your ops team gets one place to manage TLS certificates and network rules.
How Gerrit and Traefik handle login and traffic
Gerrit listens on two main network ports during normal daily use. One port serves the web app and the HTTP Git API. The second port handles direct SSH traffic for fast Git pushes and fetches. Traefik must know how to send each request type to the right port.
For web traffic, Traefik reads the host name and path from the request. It terminates the TLS connection and checks your security rules. Then it forwards the plain HTTP request to the Gerrit web port. It also adds standard headers so Gerrit knows the original client address.
User login often works by passing identity headers between the two tools. An external login service checks the user identity at the edge first. Next, Traefik sends the verified user name or email header to Gerrit. Gerrit reads that header and logs the user into the right account. You must lock down the internal network so nobody can spoof that header.
SSH traffic works in a different way than standard web requests. Traefik uses a TCP router to catch incoming SSH traffic on a set port. It does not read the SSH data or swap out the keys. Instead, it passes the raw TCP stream straight to the Gerrit SSH port. Gerrit then checks the developer public key against its own account database.
Common failure modes and how to scope network paths
Several common mistakes break this setup when teams move to production. The most frequent problem involves reverse headers and canonical web URLs. If Gerrit does not know its public URL, it builds broken redirect links. Users log in and then hit an error page or a dead link. You must set the public URL in Gerrit to match the outer route.
End-to-End Encryption + Traefik Middleware Security: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Shared bot accounts also create big security gaps for engineering teams. Teams often create one admin token in Gerrit for all build tools. If that broad token leaks, an attacker can read or alter any repo. Instead, give each build worker its own service account with strict repo roles.
Unlogged traffic paths cause another major blind spot during security audits. When TCP forwarding passes raw SSH streams, edge logs miss the Git commands. You only see connection times and byte counts at the network router level. You must turn on audit logs inside Gerrit to track who cloned what code.
You should also restrict network paths between the edge router and the review server. Put both services on a private network segment with strict firewall rules. Only allow the router host to talk to the Gerrit HTTP login port. This stops internal attackers from sending fake login headers straight to Gerrit. Finally, mask sensitive fields like emails or phone numbers in your shared log files.
Keeping repo operations safe as your team grows
As your team grows, managing SSH keys and web rules takes more time. Developers need fast access to push code without fighting network blocks. At the same time, security teams need clear logs of every repo action. Keeping network routes simple and roles tight helps both groups work well.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
Can Traefik route both HTTP and SSH traffic to Gerrit?
Yes, it handles both protocol types using separate entry points. You use standard HTTP routers for the web UI and TCP routers for SSH.
Why does Gerrit redirect to the wrong URL after login?
This happens when the canonical web URL setting in Gerrit does not match. Make sure Gerrit knows the exact public domain and scheme that the router uses.
How do you stop users from bypassing header login rules?
Place Gerrit on an isolated private network that only the router can reach. Never expose the backend HTTP port directly to user machines or untrusted networks.
Related guides
In this post