Sindbad~EG File Manager
<?php
namespace O2switch\CpanelLib\Helper;
use O2switch\CpanelLib\Entity\Customization;
class ProxyInfo
{
/**
* Return the proxyPassConfig for ipxtender, based on whether a cache is activated or not.
* @param Customization $customization
* @param string $key
* @return mixed|null
*/
public static function getIpxtenderProxyPassInfo(Customization $customization, string $key){
$map = [
Customization::APP_NGINX => [
'listenToPort' => 80,
'listenToSslPort' => 443,
'proxyPassIp' => $customization->getOriginalBackendIP(),
'proxyPassPort' => 8081,
'proxyPassProtocol' => 'http',
'proxyPassSslIp' => $customization->getOriginalBackendIP(),
'proxyPassSslPort' => 4430,
'proxyPassSslProtocol' => 'https',
],
Customization::APP_VARNISH => [
'listenToPort' => 80,
'listenToSslPort' => 443,
'proxyPassIp' => isset($customization->getChains()[1]) ? $customization->getChains()[1]->getServerIp() : '109.234.163.160',
'proxyPassPort' => 6081,
'proxyPassProtocol' => 'http',
'proxyPassSslIp' => isset($customization->getChains()[1]) ? $customization->getChains()[1]->getServerIp() : '109.234.163.160',
'proxyPassSslPort' => 6081,
'proxyPassSslProtocol' => 'http',
],
Customization::APP_LSCACHE => [
'listenToPort' => 80,
'listenToSslPort' => 443,
'proxyPassIp' => isset($customization->getChains()[1]) ? $customization->getChains()[1]->getServerIp() : '109.234.163.160',
'proxyPassPort' => 8081,
'proxyPassProtocol' => 'http',
'proxyPassSslIp' => isset($customization->getChains()[1]) ? $customization->getChains()[1]->getServerIp() : '109.234.163.160',
'proxyPassSslPort' => 8081,
'proxyPassSslProtocol' => 'http',
]
];
switch($customization->getType()){
case 'ipxtender':
case 'disabledCase':
default:
$app = Customization::APP_NGINX;
break;
case 'lscache':
case 'litespeed':
case 'ipxtenderAndLscache':
$app = Customization::APP_LSCACHE;
break;
case 'varnish':
case 'xtremcache':
case 'ipxtenderAndXtremcache':
case 'ipxtenderAndCache':
case 'cache':
$app = Customization::APP_VARNISH;
break;
}
return $map[$app][$key] ?? null;
}
}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists