Skip to content

Firefly III: a personal finances manager

Add option to disable the X-Frame header

James Cole1b3b39d2ea3d
diff --git a/.env.docker b/.env.docker
index 8836909ef3..7267344004 100644
--- a/.env.docker
+++ b/.env.docker
@@ -146,6 +146,10 @@ WINDOWS_SSO_KEY=${WINDOWS_SSO_KEY}
# field to sync as local username.
ADLDAP_SYNC_FIELD=${ADLDAP_SYNC_FIELD}
+# You can disable the X-Frame-Options header if it interfears with tools like
+# Organizr. This is at your own risk.
+DISABLE_FRAME_HEADER=${DISABLE_FRAME_HEADER}
+
# Leave the following configuration vars as is.
# Unless you like to tinker and know what you're doing.
APP_NAME=FireflyIII
diff --git a/.env.example b/.env.example
index 450df3f03e..a626fb6648 100644
--- a/.env.example
+++ b/.env.example
@@ -147,6 +147,10 @@ WINDOWS_SSO_KEY=AUTH_USER
# field to sync as local username.
ADLDAP_SYNC_FIELD=userprincipalname
+# You can disable the X-Frame-Options header if it interfears with tools like
+# Organizr. This is at your own risk.
+DISABLE_FRAME_HEADER=false
+
# Leave the following configuration vars as is.
# Unless you like to tinker and know what you're doing.
APP_NAME=FireflyIII
diff --git a/.env.heroku b/.env.heroku
index 72237088cd..91265ca0b9 100644
--- a/.env.heroku
+++ b/.env.heroku
@@ -147,6 +147,10 @@ WINDOWS_SSO_KEY=AUTH_USER
# field to sync as local username.
ADLDAP_SYNC_FIELD=userprincipalname
+# You can disable the X-Frame-Options header if it interfears with tools like
+# Organizr. This is at your own risk.
+DISABLE_FRAME_HEADER=false
+
# Leave the following configuration vars as is.
# Unless you like to tinker and know what you're doing.
APP_NAME=FireflyIII
diff --git a/.env.sandstorm b/.env.sandstorm
index d858fd02f9..45842c2845 100755
--- a/.env.sandstorm
+++ b/.env.sandstorm
@@ -147,6 +147,10 @@ WINDOWS_SSO_KEY=AUTH_USER
# field to sync as local username.
ADLDAP_SYNC_FIELD=userprincipalname
+# You can disable the X-Frame-Options header if it interfears with tools like
+# Organizr. This is at your own risk.
+DISABLE_FRAME_HEADER=true
+
# Leave the following configuration vars as is.
# Unless you like to tinker and know what you're doing.
APP_NAME=FireflyIII
diff --git a/.env.testing b/.env.testing
index a62f25abcf..0ac26d6891 100644
--- a/.env.testing
+++ b/.env.testing
@@ -147,6 +147,10 @@ WINDOWS_SSO_KEY=AUTH_USER
# field to sync as local username.
ADLDAP_SYNC_FIELD=userprincipalname
+# You can disable the X-Frame-Options header if it interfears with tools like
+# Organizr. This is at your own risk.
+DISABLE_FRAME_HEADER=false
+
# Leave the following configuration vars as is.
# Unless you like to tinker and know what you're doing.
APP_NAME=FireflyIII
diff --git a/app/Http/Middleware/SecureHeaders.php b/app/Http/Middleware/SecureHeaders.php
index 39168deabe..f25d417b12 100644
--- a/app/Http/Middleware/SecureHeaders.php
+++ b/app/Http/Middleware/SecureHeaders.php
@@ -76,7 +76,10 @@ class SecureHeaders
"payment 'none'",
];
- $response->header('X-Frame-Options', 'deny');
+ $disableFrameHeader = env('DISABLE_FRAME_HEADER');
+ if (false === $disableFrameHeader || null === $disableFrameHeader) {
+ $response->header('X-Frame-Options', 'deny');
+ }
$response->header('Content-Security-Policy', implode('; ', $csp));
$response->header('X-XSS-Protection', '1; mode=block');
$response->header('X-Content-Type-Options', 'nosniff');