Sfoglia il codice sorgente

server auth redirect for traefik (#1240)

CauseFX 6 anni fa
parent
commit
a5e8d75dcd
2 ha cambiato i file con 10 aggiunte e 2 eliminazioni
  1. 1 0
      api/config/default.php
  2. 9 2
      api/functions/organizr-functions.php

+ 1 - 0
api/config/default.php

@@ -261,4 +261,5 @@ return array(
 	'enableLocalAddressForward' => false,
 	'performanceDisableIconDropdown' => false,
 	'performanceDisableImageDropdown' => false,
+	'traefikAuthEnable' => false
 );

+ 9 - 2
api/functions/organizr-functions.php

@@ -823,7 +823,14 @@ function getSettingsMain()
 						'value' => 'allow-top-navigation'
 					),
 				)
-			)
+			),
+			array(
+				'type' => 'switch',
+				'name' => 'traefikAuthEnable',
+				'label' => 'Enable Traefik Auth Redirect',
+				'help' => 'This will enable the webserver to forward errors so traefik will accept them',
+				'value' => $GLOBALS['traefikAuthEnable']
+			),
 		),
 		'Performance' => array(
 			array(
@@ -1684,7 +1691,7 @@ function auth()
 		}
 	}
 	if ($group !== null) {
-		if ($_SERVER['HTTP_X_FORWARDED_SERVER'] == 'traefik') {
+		if ($_SERVER['HTTP_X_FORWARDED_SERVER'] == 'traefik' || $GLOBALS['traefikAuthEnable']) {
 			$redirect = 'Location: ' . getServerPath();
 		}
 		if (qualifyRequest($group) && $unlocked) {