allow configuration of auth_proxy_pass through

environment variable
This commit is contained in:
Peter Morton 2023-10-13 16:37:05 -05:00
parent 300abb5360
commit 520c20b4d8
3 changed files with 24 additions and 23 deletions

View File

@ -11,6 +11,7 @@ RUN npm run build
FROM nginx:stable-alpine as production-stage FROM nginx:stable-alpine as production-stage
COPY --from=build-stage /app/dist /app/eo-services COPY --from=build-stage /app/dist /app/eo-services
COPY nginx.conf /etc/nginx/nginx.conf COPY nginx.conf /etc/nginx/nginx.conf
COPY default.conf.template /etc/nginx/templates/default.conf.template
COPY headers.js /etc/nginx/headers.js COPY headers.js /etc/nginx/headers.js
EXPOSE 80 EXPOSE 80
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]

23
default.conf.template Normal file
View File

@ -0,0 +1,23 @@
server {
listen 80;
server_name localhost;
location /eo-services {
mirror /mirror;
root /app;
index index.html;
try_files $uri $uri/ /eo-services/index.html;
add_header Cache-Control 'no-store';
}
location /mirror {
internal;
proxy_pass ${AUTH_PROXY_PASS};
proxy_set_header X-Original-URI $request_uri;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

View File

@ -28,27 +28,4 @@ http {
access_log /var/log/nginx/access.log main; access_log /var/log/nginx/access.log main;
sendfile on; sendfile on;
keepalive_timeout 65; keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location /eo-services {
mirror /mirror;
root /app;
index index.html;
try_files $uri $uri/ /eo-services/index.html;
add_header Cache-Control 'no-store';
}
location /mirror {
internal;
proxy_pass https://eo-services.mortons.site/api/auth;
proxy_set_header X-Original-URI $request_uri;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
} }