1
0
mirror of https://github.com/typemill/typemill.git synced 2025-07-31 11:20:15 +02:00

Fix proxy detection and force base url

This commit is contained in:
trendschau
2024-03-01 15:06:58 +01:00
parent 6bc85bd8da
commit eb9efcb6bb
4 changed files with 27 additions and 9 deletions

View File

@@ -196,16 +196,16 @@ class ControllerWebSystem extends Controller
{
$licensefields[$key]['disabled'] = true;
}
}
# check license data
$licensecheck = $license->checkLicense($licensedata, $this->c->get('urlinfo'));
if(!$licensecheck)
{
$message = $license->getMessage();
}
# check license data
$licensecheck = $license->checkLicense($licensedata, $this->c->get('urlinfo'));
if(!$licensecheck)
{
$message = $license->getMessage();
}
unset($licensedata['signature']);
unset($licensedata['signature']);
}
return $this->c->get('view')->render($response, 'system/license.twig', [
'settings' => $this->settings,

View File

@@ -69,7 +69,7 @@ class Urlinfo
private static function removeStandardPorts($uri)
{
$port = $uri->getPort();
if ($port == 80 || $port == 443)
if (!$port || $port == 80 || $port == 443)
{
$uri = $uri->withPort(null);
}

View File

@@ -239,6 +239,9 @@ fieldsetdeveloper:
trustedproxies:
type: text
label: "Trusted IPs for proxies (comma separated)"
fqdn:
type: text
label: "If your proxy does not work, try to add the base-url of your proxy here like https://mywebsite.com."
headersoff:
type: checkbox
label: "Disable Custom Headers"

View File

@@ -119,6 +119,21 @@ $app->setBasePath($basepath);
$uriFactory = new UriFactory();
$uri = $uriFactory->createFromGlobals($_SERVER);
if(
isset($settings['proxy']) &&
$settings['proxy'] &&
isset($_SERVER['HTTP_X_FORWARDED_HOST']) &&
isset($settings['fqdn']) &&
$settings['fqdn'] != ''
)
{
$fqdn = $uriFactory->createUri($settings['fqdn']);
$uri = $uri->withScheme($fqdn->getScheme())
->withHost($fqdn->getHost())
->withPort($fqdn->getPort());
}
$urlinfo = Urlinfo::getUrlInfo($basepath, $uri, $settings);
$timer['settings'] = microtime(true);