Yol Tabanlı Mikro Hizmet Yönlendirme
Tek bir giriş noktasının arkasındaki farklı arka uç mikro hizmetlerine farklı URL yollarını yönlendirmek için Nginx konum eşleştirmesini kullanın.
Yol Tabanlı Mikro Hizmet Yönlendirme, CoddyKit'te ücretsiz bir API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) dersidir. Bu, 4 dersinin 4. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
One Door, Many Services
In a microservice system, clients should hit a single host while Nginx fans requests out to the right service based on the URL path.
This keeps clients simple and hides the internal topology.
The location Directive
Routing decisions live in location blocks. Each matches a path pattern and proxies to a specific upstream.
location /users/ {
proxy_pass http://users-service/;
}
location /orders/ {
proxy_pass http://orders-service/;
}Defining Upstreams
Name each service in an upstream block so locations stay readable and you can scale instances later.
upstream users-service {
server 10.0.0.1:8080;
}
upstream orders-service {
server 10.0.0.2:8080;
}Prefix vs Exact Match
A plain location /path/ is a prefix match. Use = for an exact match, which is faster and avoids accidental overlaps.
location = /health {
return 200 "ok";
}The Trailing Slash Rule
A trailing slash on proxy_pass changes path rewriting. With proxy_pass http://svc/; the matched prefix is stripped; without it the full path is forwarded.
location /users/ {
proxy_pass http://users-service/;
}
# /users/42 -> upstream sees /42Regex Locations
Prefix with ~ for case-sensitive regex matching, useful for routing by file type or dynamic segments.
location ~ ^/api/v[0-9]+/payments {
proxy_pass http://payments-service;
}Matching Priority
Nginx evaluates locations in a defined order: exact =, then literal prefixes, then regex in file order. Understanding this prevents surprising routes.
A Default Catch-All
Add a fallback location to serve a friendly response for unknown paths instead of leaking a default error.
location / {
return 404 "Unknown service";
}Shared Proxy Settings
Keep forwarding headers consistent across all services by including a shared snippet in each location.
location /users/ {
include /etc/nginx/proxy_headers.conf;
proxy_pass http://users-service/;
}Adding a New Service
Onboarding a service is just a new upstream plus a new location, no client changes required, which is the whole point of a gateway.
upstream search-service { server 10.0.0.3:8080; }
location /search/ {
proxy_pass http://search-service/;
}Testing the Routes
After reloading, curl each path and confirm it reaches the intended service.
curl http://localhost/users/42
curl http://localhost/orders/7Quick Check
With location /users/ { proxy_pass http://users-service/; }, what path does the upstream receive for a request to /users/42?
Recap
You built path-based routing to multiple services:
locationblocks map paths to upstreams- Trailing slash on
proxy_passcontrols prefix stripping - Match types: exact
=, prefix, and~regex - A catch-all handles unknown paths
One host now cleanly fronts an entire fleet of microservices.
Yapay zeka eğitmeniyle API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) öğren — ücretsiz
Tarayıcında gerçek kod yaz ve çalıştır, 7/24 yapay zeka eğitmeninden anında yardım al; web'de ya da uygulamada kaldığın yerden devam et.
- Kurslar
- 12
- Dersler
- 48
Sıkça Sorulan Sorular
“Yol Tabanlı Mikro Hizmet Yönlendirme” dersi ücretsiz mi?
Evet — “Yol Tabanlı Mikro Hizmet Yönlendirme” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) kursu toplamda 4 dersten oluşur.
“Yol Tabanlı Mikro Hizmet Yönlendirme” dersinde ne öğreneceğim?
Tek bir giriş noktasının arkasındaki farklı arka uç mikro hizmetlerine farklı URL yollarını yönlendirmek için Nginx konum eşleştirmesini kullanın. API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway), başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 4. dersidir.
“Yol Tabanlı Mikro Hizmet Yönlendirme” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) dersinde kod yazıp çalıştırabilir miyim?
Evet. Her API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.
Bu kursun tüm dersleri
- Nginx ile API Sürümleme
- Kökenler Arası Kaynak Paylaşımı (CORS)
- Nginx ile Hız Sınırlama ve Kısıtlama
- Yol Tabanlı Mikro Hizmet Yönlendirme