Hiya!
I’ve switched back from Webfaction to my old host because of having 500 errors.
Now, I installed on the new/old host, but have strange problem...Cherokee is running as proxy on my local port 62845, and now when I try to access it via
gour-nitai.com, front-end generates strange URLs like:
http://gour-nitai.com:62845/assets/components/modxss/css/layout.css
Here is the relevant snippet from the
config.inc.php:
if (!defined('MODX_HTTP_HOST')) {
if(defined('PHP_SAPI') && (PHP_SAPI == "cli" || PHP_SAPI == "embed")) {
[b]$http_host='gour-nitai.com:62845';[/b]
define('MODX_HTTP_HOST', $http_host);
} else {
$http_host= $_SERVER['HTTP_HOST'];
if ($_SERVER['SERVER_PORT'] != 80) {
$http_host= str_replace(':' . $_SERVER['SERVER_PORT'], '', $http_host); // remove port from HTTP_HOST
}
$http_host .= ($_SERVER['SERVER_PORT'] == 80 || $isSecureRequest) ? '' : ':' . $_SERVER['SERVER_PORT'];
define('MODX_HTTP_HOST', $http_host);
}
}
Now, the question is:
- 1) is there any workaround?
- 2) wouldn’t it some better solution for MODx instead of hardcoding line like $http_host=’gour-nitai.com:62845’;?
The problem is visible in front-end only and not in manager which works fine.
Is it a bug or a feature?
Edit:
I ’fixed’ the issue by leaving only:
$http_host= $_SERVER['HTTP_HOST'];
I’m not sure if I miss something obvious, but I do not see the logic of removing port from HTTP_HOST and then testing the same thing again and appending port number
Iow, I believe that
if ($_SERVER['SERVER_PORT'] != 80) {
$http_host= str_replace(':' . $_SERVER['SERVER_PORT'], '', $http_host); // remove port from HTTP_HOST
}
does not make sense?