Security: protect app with HTTP Basic Auth
This commit is contained in:
@@ -4,6 +4,8 @@ server {
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
auth_basic "Acces protege";
|
||||
auth_basic_user_file /etc/nginx/.htpasswd;
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://video-games-api:3001/api/;
|
||||
@@ -15,6 +17,7 @@ server {
|
||||
}
|
||||
|
||||
location = /health {
|
||||
auth_basic off;
|
||||
proxy_pass http://video-games-api:3001/health;
|
||||
proxy_http_version 1.1;
|
||||
}
|
||||
|
||||
9
nginx/entrypoint.sh
Executable file
9
nginx/entrypoint.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
BASIC_USER="${APP_BASIC_AUTH_USER:-admin}"
|
||||
BASIC_PASS="${APP_BASIC_AUTH_PASSWORD:-change_me_now}"
|
||||
|
||||
htpasswd -bc /etc/nginx/.htpasswd "$BASIC_USER" "$BASIC_PASS" >/dev/null
|
||||
|
||||
exec nginx -g 'daemon off;'
|
||||
Reference in New Issue
Block a user