w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Setting up routing for Cakephp application on AWS cloudfront and elastic load balance (using beanstalk)

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):


© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.