Added cross origin parameters to nginx location parts

This commit is contained in:
2022-12-09 11:55:23 +00:00
parent aff9c5efd6
commit b52f04347c
2 changed files with 4 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
global global
log stdout format raw local0 debug log stdout format raw local0 info
defaults defaults
mode http mode http
option redispatch option redispatch

View File

@@ -85,6 +85,7 @@ if [[ "$HTTP_PORT" != "" && "$HTTP_PORT" != "80" ]]; then
else else
echo "location / {" echo "location / {"
echo "add_header 'Access-Control-Allow-Origin' '*' always;"
if [[ "$ALLOWED_NETWORK" != "" ]]; then if [[ "$ALLOWED_NETWORK" != "" ]]; then
ALLOWED_NETWORK_IDX=$(jq -r '.ALLOWED_NETWORK | length' $DOMAIN_SOURCE) ALLOWED_NETWORK_IDX=$(jq -r '.ALLOWED_NETWORK | length' $DOMAIN_SOURCE)
@@ -177,7 +178,7 @@ location = /$ERROR_PAGE {
root html; root html;
allow all; allow all;
index 404.html; index 404.html;
rewrite ^ "'$scheme'":http://$ERROR_PAGE"'$request_uri'" permanent; rewrite ^ "'$scheme' "http://$ERROR_PAGE"'$request_uri'" permanent;
}" }"
fi fi
@@ -185,6 +186,7 @@ location = /$ERROR_PAGE {
echo "return 301 $REDIRECT_HTTPS;" echo "return 301 $REDIRECT_HTTPS;"
else else
echo "location / {" echo "location / {"
echo "add_header 'Access-Control-Allow-Origin' '*' always;"
if [[ "$ALLOWED_NETWORK" != "" ]]; then if [[ "$ALLOWED_NETWORK" != "" ]]; then
ALLOWED_NETWORK_IDX=$(jq -r '.ALLOWED_NETWORK | length' $DOMAIN_SOURCE) ALLOWED_NETWORK_IDX=$(jq -r '.ALLOWED_NETWORK | length' $DOMAIN_SOURCE)