What is an API Gateway and how does Spring Cloud Gateway work? API गेटवे क्या है और स्प्रिंग क्लाउड गेटवे कैसे काम करता है?
An API Gateway is a single entry point that sits in front of all microservices, routing incoming requests to the correct downstream service and centralizing cross-cutting concerns like authentication, rate limiting, request/response logging, and CORS, so individual services don't need to reimplement them.
Spring Cloud Gateway, built on Project Reactor for non-blocking, reactive routing, matches requests to routes based on predicates (path, header, method) and applies filters (add headers, rewrite paths, apply a circuit breaker) before forwarding the request, often resolving the destination service dynamically through Eureka rather than a hardcoded URL.
spring:
cloud:
gateway:
routes:
- id: order-service
uri: lb://ORDER-SERVICE
predicates:
- Path=/api/orders/**
filters:
- StripPrefix=1API गेटवे एक एकल एंट्री पॉइंट है जो सभी माइक्रोसर्विसेज़ के सामने बैठता है, इनकमिंग रिक्वेस्ट्स को सही डाउनस्ट्रीम सर्विस पर रूट करता है, और ऑथेंटिकेशन, रेट लिमिटिंग, लॉगिंग जैसी क्रॉस-कटिंग चिंताओं को केंद्रीकृत करता है।
Spring Cloud Gateway, जो नॉन-ब्लॉकिंग, रिएक्टिव रूटिंग के लिए Project Reactor पर बना है, प्रेडिकेट्स (पाथ, हेडर, मेथड) के आधार पर रिक्वेस्ट्स को रूट्स से मैच करता है और फ़िल्टर्स लागू करता है, अक्सर Eureka के ज़रिए गंतव्य सर्विस को डायनामिक रूप से रिज़ॉल्व करता है।
spring:
cloud:
gateway:
routes:
- id: order-service
uri: lb://ORDER-SERVICE
predicates:
- Path=/api/orders/**Was this answer clear?