diff --git a/startup.sh b/startup.sh
index 7877831..9e054ae 100755
--- a/startup.sh
+++ b/startup.sh
@@ -54,6 +54,14 @@ fi
if [ "${CORS_ENABLED}" = "true" ]; then
if ! grep -q DockerGeoServerCorsFilter "$CATALINA_HOME/webapps/geoserver/WEB-INF/web.xml"; then
echo "Enable CORS for $CATALINA_HOME/webapps/geoserver/WEB-INF/web.xml"
+
+ # Add support for access-control-allow-credentials when the origin is not a wildcard
+ if [ "${CORS_ALLOWED_ORIGINS}" != "*" ]; then
+ CORS_ALLOW_CREDENTIALS="true"
+ else
+ CORS_ALLOW_CREDENTIALS="false"
+ fi
+
sed -i "\::i\\
\n\
DockerGeoServerCorsFilter\n\
@@ -70,6 +78,10 @@ if [ "${CORS_ENABLED}" = "true" ]; then
cors.allowed.headers\n\
${CORS_ALLOWED_HEADERS}\n\
\n\
+ \n\
+ cors.support.credentials\n\
+ ${CORS_ALLOW_CREDENTIALS}\n\
+ \n\
\n\
\n\
DockerGeoServerCorsFilter\n\