.env: add AUTH_MODE for nginx.conf

This commit is contained in:
vchikalkin 2023-11-01 00:07:05 +03:00
parent 661da1fed5
commit 644bbfa13b
3 changed files with 16 additions and 22 deletions

2
.env
View File

@ -5,3 +5,5 @@ TRAEFIK_ENTRYPOINTS=web-secure
# TRAEFIK_ENTRYPOINTS=web-secure-ext
WEB_HOST=
APPLICATION=
AUTH_MODE=ldap
# AUTH_MODE=standard

View File

@ -26,6 +26,17 @@ server {
gzip_disable "msie6";
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
proxy_set_header X-Original-URI $request_uri;
proxy_set_header X-Original-Remote-Addr $remote_addr;
proxy_set_header X-Original-Host $host;
error_page 401 /login;
@ -36,41 +47,21 @@ server {
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
proxy_set_header X-Original-Remote-Addr $remote_addr;
proxy_set_header X-Original-Host $host;
proxy_intercept_errors on;
}
location ~ ^/(signin|logout|get-user) {
proxy_pass http://auth_api;
proxy_redirect off;
proxy_set_header X-Original-URI $request_uri;
proxy_set_header X-Original-Remote-Addr $remote_addr;
proxy_set_header X-Original-Host $host;
location ~ ^/(signin|logout|get-user)$ {
proxy_pass http://auth_api/$AUTH_MODE/$1;
}
location ~ ^/login {
proxy_pass http://auth_web;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location / {
proxy_pass http://app;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
auth_request /auth;
auth_request_set $auth_cookie $upstream_http_set_cookie;
add_header Set-Cookie $auth_cookie;

View File

@ -8,6 +8,7 @@ services:
image: nginx:alpine
environment:
- APPLICATION=${APPLICATION}
- AUTH_MODE=${AUTH_MODE}
volumes:
- ./config/nginx.conf:/etc/nginx/templates/default.conf.template
- ./config/include:/etc/nginx/include