Skip to content

Commit

Permalink
feature: nginx auth-service proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
Stepasha419a committed Dec 13, 2024
1 parent 1e94894 commit 8d20724
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .env.dev
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
VITE_USER_SERVICE_URL=http://localhost:5000
VITE_CHAT_SERVICE_URL=http://localhost:5001
VITE_FILE_SERVICE_URL=http://localhost:5002
VITE_AUTH_SERVICE_URL=http://localhost:5003
VITE_AUTH_SERVICE_URL=https://localhost:3000/auth-service-url

VITE_MODE=dev

PROXY_PORT=3000
CLIENT_URL=http://host.docker.internal:3001

PROXY_AUTH_SERVICE=/auth-service-url

AUTH_SERVICE_URL=https://host.docker.internal:5003
2 changes: 2 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ services:
/bin/sh -c "envsubst '
\$\{PROXY_PORT\}
\$\{CLIENT_URL\}
\$\{PROXY_AUTH_SERVICE\}
\$\{AUTH_SERVICE_URL\}
' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && nginx -g 'daemon off;'"
16 changes: 16 additions & 0 deletions nginx/nginx-dev.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,21 @@ http {

add_header X-Proxy-Server $http_upgrade;
}

location ${PROXY_AUTH_SERVICE}/ {
proxy_pass ${AUTH_SERVICE_URL}/;
proxy_http_version 1.1;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Connection "upgrade";

proxy_ssl_certificate /etc/nginx/cert/dev/certificate.pem;
proxy_ssl_certificate_key /etc/nginx/cert/dev/private-key.pem;

proxy_cookie_path ~*^/.* /;

proxy_cache_bypass $http_upgrade;
}
}
}

0 comments on commit 8d20724

Please sign in to comment.