Created
February 23, 2024 18:07
-
-
Save sagar290/b6fa52e73fd16a77404748317daa94c9 to your computer and use it in GitHub Desktop.
api-gateway.local
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream authUpstream { | |
server auth:9090 max_fails=0 fail_timeout=10s; | |
keepalive 512; | |
} | |
upstream service1Upstream { | |
server services1:9091 max_fails=0 fail_timeout=10s; | |
keepalive 512; | |
} | |
upstream service2Upstream { | |
server services2:9092 max_fails=0 fail_timeout=10s; | |
keepalive 512; | |
} | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name api-gateway.local; | |
location /service1/ { | |
auth_request /auth-server/validate; | |
auth_request_set $auth_status $upstream_status; | |
proxy_pass http://service1Upstream/; | |
} | |
location /service2/ { | |
auth_request /auth-server/validate; | |
auth_request_set $auth_status $upstream_status; | |
proxy_pass http://service2Upstream/; | |
} | |
location /auth-server/ { | |
internal; | |
proxy_pass http://authUpstream/; | |
proxy_buffers 8 16k; | |
proxy_buffer_size 32k; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment