r/ProgrammingBuddies • u/InternetMedium4953 • 21h ago
I built a multi-tenant API gateway in Spring Boot and spent a day debugging one header
I built GateKeeper, a multi-tenant API gateway in Java and Spring Boot. To test it with a real frontend, I connected a musical instrument store to it. When you open the catalog, the request goes through GateKeeper on AWS EC2 before reaching the store’s backend on Render.
The project has three services.
- API Management lets platform admins onboard organizations and tenant admins configure their own routes. Each route can have its own allowed methods, timeout, rate limit and header rules. Changes are versioned and recorded in an audit log.
- Smart Gateway matches the tenant’s route, rewrites the path and forwards the request. Redis tracks rate limits per route and client IP. Kafka lets the gateway pick up route changes without a restart.
- Analytics consumes request events from Kafka and stores them in MongoDB. The dashboard shows request latency, HTTP status, error rates and traffic by route and region.
One bug ate up my whole day. Render was returning 200, but the public URL kept giving me a 502.
I traced it to the gateway copying HTTP/2’s :status field into an HTTP/1.1 response, which nginx rejected.
I filtered out the pseudo-header, redeployed the gateway, and got a 200 through the public URL.
Smart Gateway source
https://github.com/Tech-Achintya/gateway-microservice-apigateway
API Management source
https://github.com/Tech-Achintya/api-mangement-microservice-apigateway
Analytics source
https://github.com/Tech-Achintya/analytics-microservice-apigateway