From fe92039487fda2a7320a716bf1e4f604b17e519a Mon Sep 17 00:00:00 2001 From: "Noah W. Smith" Date: Mon, 13 May 2024 14:30:51 -0400 Subject: [PATCH 1/3] add DRUPAL_CORS variable --- drupal/rootfs/etc/confd/templates/drupal.fpm.conf.tmpl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drupal/rootfs/etc/confd/templates/drupal.fpm.conf.tmpl b/drupal/rootfs/etc/confd/templates/drupal.fpm.conf.tmpl index 77f38cb6..74d6a5d4 100644 --- a/drupal/rootfs/etc/confd/templates/drupal.fpm.conf.tmpl +++ b/drupal/rootfs/etc/confd/templates/drupal.fpm.conf.tmpl @@ -26,6 +26,9 @@ location ~ '\.php$|^/update.php' { fastcgi_param HTTPS on; fastcgi_param HTTP_SCHEME https; {{ end }} + {{ if [-z "${DRUPAL_CORS}"] }} + add_header Access-Control-Allow-Origin '{{ getenv "DRUPAL_CORS" }}'; + {{ end }} fastcgi_intercept_errors on; # Large Islandora repositories global searches end up with HUGE header sizes fastcgi_buffers 16 800k; From 253d2b7b6984751777f70ffa1216c6bee9f4c949 Mon Sep 17 00:00:00 2001 From: "Noah W. Smith" Date: Mon, 13 May 2024 14:40:24 -0400 Subject: [PATCH 2/3] trying different syntax for inclusion --- drupal/rootfs/etc/confd/templates/drupal.fpm.conf.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drupal/rootfs/etc/confd/templates/drupal.fpm.conf.tmpl b/drupal/rootfs/etc/confd/templates/drupal.fpm.conf.tmpl index 74d6a5d4..f58dfe17 100644 --- a/drupal/rootfs/etc/confd/templates/drupal.fpm.conf.tmpl +++ b/drupal/rootfs/etc/confd/templates/drupal.fpm.conf.tmpl @@ -26,7 +26,7 @@ location ~ '\.php$|^/update.php' { fastcgi_param HTTPS on; fastcgi_param HTTP_SCHEME https; {{ end }} - {{ if [-z "${DRUPAL_CORS}"] }} + {{ if ne (getenv "DRUPAL_CORS") "" }} add_header Access-Control-Allow-Origin '{{ getenv "DRUPAL_CORS" }}'; {{ end }} fastcgi_intercept_errors on; From 089cadb6260645caf990698638cda334ada279c5 Mon Sep 17 00:00:00 2001 From: "Noah W. Smith" Date: Mon, 13 May 2024 14:55:33 -0400 Subject: [PATCH 3/3] documentation for new DRUPAL_CORS variable --- drupal/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/drupal/README.md b/drupal/README.md index 8677dbc4..aa25e38a 100644 --- a/drupal/README.md +++ b/drupal/README.md @@ -27,6 +27,7 @@ additional settings, volumes, ports, etc. | :----------------------- | :------ | :--------------------------------------------------------------------------------- | | DRUPAL_ENABLE_HTTPS | true | Inform PHP that `https` should be used. | | DRUPAL_REVERSE_PROXY_IPS | | Use the IP address for the host 'traefik' if found otherwise default to `0.0.0.0`. | +| DRUPAL_CORS | | Set a value for CORS: either (default), '*', or a single 'http://domain' | ### Database Settings