Check the return value of env('HTTP_HOST')
, that's what CakePHP uses for the base URL by default. It will probably return elb-abc123.elb.amazonaws.com
.
If you cannot change that behavior, then, depending on your CakePHP version, use FULL_BASE_URL
, App.fullBaseUrl
or Router::fullBaseURL()
to define the proper base URL on your own.
$s = null;
if (env('HTTPS')) {
$s = 's';
}
$fullBaseUrl = 'http' . $s . '://foo.com';
In your index.php
define('FULL_BASE_URL', $fullBaseUrl);
Configure::write('App.fullBaseUrl', FULL_BASE_URL);
Or at anytime (assuming the Router
class is available):
Router::fullBaseUrl($fullBaseUrl);