File tree Expand file tree Collapse file tree 4 files changed +20
-2
lines changed Expand file tree Collapse file tree 4 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,11 @@ ENV API_KEY="**None**" \
1313 PORT="8080" \
1414 PORT_IPV6="" \
1515 BASE_URL="/" \
16- SWAGGER_JSON_URL=""
16+ SWAGGER_JSON_URL="" \
17+ CORS="true" \
18+ EMBEDDING="false"
1719
18- COPY --chown=nginx:nginx --chmod=0666 ./docker/default.conf.template ./docker/cors.conf /etc/nginx/templates/
20+ COPY --chown=nginx:nginx --chmod=0666 ./docker/default.conf.template ./docker/cors.conf ./docker/embedding.conf /etc/nginx/templates/
1921
2022COPY --chmod=0666 ./dist/* /usr/share/nginx/html/
2123COPY --chmod=0555 ./docker/docker-entrypoint.d/ /docker-entrypoint.d/
Original file line number Diff line number Diff line change 3838 }
3939
4040 include templates/cors.conf;
41+ include templates/embedding.conf;
4142 }
4243 }
Original file line number Diff line number Diff line change @@ -39,4 +39,14 @@ if [[ -n "${PORT_IPV6}" ]]; then
3939 sed -i " s|${PORT} ;|${PORT} ;\n listen [::]:${PORT_IPV6} ;|g" $NGINX_CONF
4040fi
4141
42+ # enable/disable CORS
43+ if [ " $CORS " != " true" ]; then
44+ truncate -s 0 /etc/nginx/templates/cors.conf
45+ fi
46+
47+ # allow/disallow embedding the swagger-ui in frames/iframes from different origins
48+ if [ " $EMBEDDING " != " false" ]; then
49+ truncate -s 0 /etc/nginx/templates/embedding.conf
50+ fi
51+
4252find $NGINX_ROOT -type f -regex " .*\.\(html\|js\|css\)" -exec sh -c " gzip < {} > {}.gz" \;
Original file line number Diff line number Diff line change 1+ #
2+ # Prevent displaying inside an iframe
3+ #
4+ add_header 'X-Frame-Options' 'DENY' always;
5+ add_header 'Content-Security-Policy' "frame-ancestors 'none'" always;
You can’t perform that action at this time.
0 commit comments