File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ COPY ./compose/frontend/default.conf /etc/nginx/conf.d
3434COPY ./compose/frontend/default_maintenance.txt /etc/nginx
3535COPY ./compose/frontend/legacy_redirects.conf /etc/nginx
3636COPY ./compose/frontend/security_headers.conf /etc/nginx/conf.d
37+ COPY ./compose/frontend/blocked_ips.conf /etc/nginx/conf.d
3738COPY --from=buildnode /app/build /usr/share/nginx/html
3839RUN chmod -R 777 /run /var/log/nginx /var/cache/nginx /usr/share/nginx/html/static/js /usr/share/nginx/html/static/css /usr/share/nginx/html/static/media /etc/nginx/conf.d
3940
Original file line number Diff line number Diff line change @@ -56,6 +56,10 @@ error_log /var/log/nginx/error.log;
5656
5757open_log_file_cache max=1000 inactive=20s valid=1m min_uses=2;
5858
59+ # Trust OpenShift Router IP range
60+ set_real_ip_from 10.0.0.0/8;
61+ real_ip_header X-Forwarded-For;
62+
5963# --- CONSOLIDATED REDIRECTS BLOCK ---
6064server {
6165 listen 3000;
@@ -82,6 +86,7 @@ server {
8286 root /usr/share/nginx/html;
8387 access_log /logs/$hostname-$formatted_date-access.log drivebc;
8488 server_tokens off;
89+ include /etc/nginx/conf.d/blocked_ips.conf;
8590 include /etc/nginx/conf.d/security_headers.conf;
8691
8792 location ~* \.(?:css|js|woff|woff2|ttf|eot|svg|png|jpe?g|gif|ico)$ {
Original file line number Diff line number Diff line change 4848 echo " Environment is not 'prod', keeping X-Robots-Tag noindex header."
4949fi
5050
51+ # Create blocked IPs configuration file
52+ BLOCKED_CONF=" /etc/nginx/conf.d/blocked_ips.conf"
53+ > " $BLOCKED_CONF "
54+ if [ -n " $BLOCKED_IPS " ]; then
55+ echo " Processing blocked IPs..."
56+ for ip in $( echo " $BLOCKED_IPS " | tr ' ;' ' ' ) ; do
57+ CLEAN_IP=$( echo " $ip " | tr -d ' ' )
58+ if [ -n " $CLEAN_IP " ]; then
59+ echo " deny $CLEAN_IP ;" >> " $BLOCKED_CONF "
60+ fi
61+ done
62+ echo " Blocked IPs configuration updated."
63+ fi
64+
5165# precompress the main js and css files to improve performance
5266gzip -k $MAIN
5367gzip -k $MAINCSS
You can’t perform that action at this time.
0 commit comments