diff --git a/root-files/opt/flownative/lib/nginx-legacy.sh b/root-files/opt/flownative/lib/nginx-legacy.sh index 8fde553..ce1041a 100644 --- a/root-files/opt/flownative/lib/nginx-legacy.sh +++ b/root-files/opt/flownative/lib/nginx-legacy.sh @@ -174,7 +174,13 @@ EOM if [ -n "${BEACH_GOOGLE_CLOUD_STORAGE_PUBLIC_BUCKET}" ]; then cat >>"${NGINX_CONF_PATH}/sites-enabled/site.conf" <<-EOM - location ~* ^${BEACH_PERSISTENT_RESOURCES_BASE_PATH}([a-f0-9]+)/ { + # redirect "subdivided" persistent resource requests to remove the subdivision parts + # e.g. _Resources/Persistent/1/2/3/4/123456789… to _Resources/Persistent/123456789… + location ~* "^${BEACH_PERSISTENT_RESOURCES_BASE_PATH}(?:[0-9a-f]/){4}([0-9a-f]{40}/.*)" { + return 301 \$scheme://\$host${BEACH_PERSISTENT_RESOURCES_BASE_PATH}\$1; + } + # pass persistent resource requests to GCS + location ~* "^${BEACH_PERSISTENT_RESOURCES_BASE_PATH}([a-f0-9]{40})/" { resolver 8.8.8.8; expires 3600; proxy_set_header Authorization "";