Skip to content

Commit

Permalink
feature: nginx user-service proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
Stepasha419a committed Dec 13, 2024
1 parent 8d20724 commit 746e4f4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .env.dev
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# proxy
VITE_USER_SERVICE_URL=https://localhost:3000/user-service-url
VITE_AUTH_SERVICE_URL=https://localhost:3000/auth-service-url

VITE_MODE=dev

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

PROXY_USER_SERVICE=/user-service-url
PROXY_AUTH_SERVICE=/auth-service-url

USER_SERVICE_URL=https://host.docker.internal:5000
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,6 +14,8 @@ services:
/bin/sh -c "envsubst '
\$\{PROXY_PORT\}
\$\{CLIENT_URL\}
\$\{PROXY_USER_SERVICE\}
\$\{PROXY_AUTH_SERVICE\}
\$\{AUTH_SERVICE_URL\}
\$\{USER_SERVICE_URL\}
' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && nginx -g 'daemon off;'"
14 changes: 14 additions & 0 deletions nginx/nginx-dev.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,19 @@ http {

proxy_cache_bypass $http_upgrade;
}

location ${PROXY_USER_SERVICE}/ {
proxy_pass ${USER_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_cache_bypass $http_upgrade;
}
}
}

0 comments on commit 746e4f4

Please sign in to comment.