File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ COPY --from=build /app/packages/web/build /app/build
31
31
32
32
COPY ./packages/web/scripts/env.sh /app/init/
33
33
COPY ./packages/web/scripts/inject-base-href.sh /app/init/
34
+ COPY ./packages/web/scripts/security.sh /app/init/
34
35
35
36
RUN chmod +x /app/init/env.sh /app/init/inject-base-href.sh && \
36
37
chmod a+w /etc/nginx/nginx.conf /app/build/index.html && \
@@ -49,6 +50,7 @@ CMD [ \
49
50
cp -R /app/nginx/. /etc/nginx && \
50
51
sh /app/init/env.sh env-config.js && \
51
52
sh /app/init/inject-base-href.sh && \
53
+ sh /app/init/security.sh && \
52
54
export DISABLE_IPV6=\" $([[ \" $ENABLE_IPV6\" = \" true\" ]] && echo \" false\" || echo \" true\" )\" && \
53
55
envsubst '$DISABLE_IPV6' < /etc/nginx/nginx.conf.tmpl | sed -e '1h;2,$H;$!d;g' -e 's/# cut true.*# end//g' > /etc/nginx/nginx.conf && \
54
56
nginx -g \" daemon off;\" " ]
Original file line number Diff line number Diff line change 43
43
gzip_http_version 1.1 ;
44
44
gzip_min_length 0 ;
45
45
gzip_types text/plain application/javascript text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype;
46
+
47
+ #SecurityHeaders
48
+
46
49
}
47
50
}
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ API_HOST=$( echo $REACT_APP_API_SERVER_ENDPOINT | sed -e ' s|http://||g' -e ' s|https://||g' )
4
+
5
+ tempFile=$( mktemp /etc/nginx/tempfile.XXXXXXXX)
6
+
7
+ cat > " ${tempFile} " << EOF
8
+
9
+ add_header X-Frame-Options "SAMEORIGIN";
10
+ add_header X-Content-Type-Options "nosniff";
11
+ add_header Referrer-Policy "strict-origin-when-cross-origin";
12
+ add_header Content-Security-Policy "default-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self' http://${API_HOST} https://${API_HOST} ws://${API_HOST} wss://${API_HOST} blob:;";
13
+ EOF
14
+
15
+ if [ " ${ENABLE_SECURITY_HEADERS} " = " true" ]; then
16
+ sed -i " /#SecurityHeaders/r ${tempFile} " /etc/nginx/nginx.conf.tmpl
17
+ fi
18
+
19
+ rm " ${tempFile} "
20
+
21
+ cat /etc/nginx/nginx.conf.tmpl
You can’t perform that action at this time.
0 commit comments