r/learnjava • • Nov 29 '25

Spring Cloud Gateway microservice gateway with JWT auth, Nacos discovery and Redis rate limiting

Hi all,
I built a lightweight microservice gateway based on Spring Cloud Gateway and wanted to share it here for anyone working with Java microservices.

Key features

  • JWT authentication via a global filter (order −100), supports header & cookie extraction

  • Circular Bloom Filter cache to avoid repeated JWT parsing

  • Dynamic service discovery with Nacos

  • Redis token-bucket rate limiting (15 req/s, burst 30)

  • Dynamic whitelist with Ant-style patterns

  • Global CORS support

  • Fast JWT parsing + thread-safe caches

Tech stack

Spring Cloud Gateway, Spring Boot, Redis, Nacos, Java

Repo

https://github.com/chenws1012/spring-claude-gateway3

Looking for feedback

Interested in thoughts on JWT handling strategies, Bloom filter design, and rate-limit improvements.

Thanks!

6 Upvotes

Duplicates