stack/deploy/nginx-vhost.local.conf

110 lines
4.1 KiB
Plaintext
Raw Permalink Normal View History

2023-06-25 00:48:39 +02:00
upstream egommerce-api-gw {
2023-06-25 00:55:25 +02:00
server 127.0.0.1:40056;
2023-06-25 00:48:39 +02:00
}
upstream egommerce-api-gw-dashboard {
2023-06-25 00:55:25 +02:00
server 127.0.0.1:40057;
2023-06-25 00:48:39 +02:00
}
upstream egommerce-api-registry-ui {
2023-06-25 00:55:25 +02:00
server 127.0.0.1:40058;
2023-06-25 00:48:39 +02:00
}
upstream egommerce-api-eventbus-mngmt {
2023-06-25 00:55:25 +02:00
server 127.0.0.1:40059;
2023-06-25 00:48:39 +02:00
}
server {
listen 443 ssl;
ssl_certificate /home/keedosn/workspace/golang/src/git.pbiernat.dev/egommerce/stack/deploy/certs/api-gateway/localhost.cert;
ssl_certificate_key /home/keedosn/workspace/golang/src/git.pbiernat.dev/egommerce/stack/deploy/certs/api-gateway/localhost.key;
server_name egommerce.local;
# Traefik redirects
location /dashboard {
if ($http_referer ~ (/gateway)) {
proxy_pass http://egommerce-api-gw-dashboard;
}
}
location /api {
if ($http_referer ~ (/gateway)) {
proxy_pass http://egommerce-api-gw-dashboard;
}
}
location /gateway/ {
proxy_pass http://egommerce-api-gw-dashboard/dashboard/;
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 0;
}
# Consul redirects
location /ui {
if ($http_referer ~ (/registry)) {
proxy_pass http://egommerce-api-registry-ui;
}
}
location /v1 {
if ($http_referer ~ (/registry)) {
proxy_pass http://egommerce-api-registry-ui;
}
}
location /registry {
proxy_pass http://egommerce-api-registry-ui;
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 0;
}
# RabbitMQ Mngmt redirects
location /eventbus {
return 302 /eventbus/;
}
location ~* /eventbus/api/(.*?)/(.*) {
proxy_pass http://egommerce-api-eventbus-mngmt/api/$1/%2F/$2?$query_string;
proxy_buffering off;
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location ~* /eventbus/(.*) {
rewrite ^/eventbus/(.*)$ /$1 break;
proxy_pass http://egommerce-api-eventbus-mngmt;
proxy_buffering off;
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Pass all requests to the API Gateway
location / {
proxy_pass https://egommerce-api-gw;
proxy_http_version 1.1;
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 0;
}
error_log /var/log/nginx/egommerce.local-error.log;
access_log /var/log/nginx/egommerce.local-access.log combined;
}