Ad

Laravel Or AWS Don't Detect My Https

I configurated my AWS beanstalk with my ssl certification, this work but in production my laravel doesn't detect the https so, It generate HTTP url and not HTTPS url. So my app bug.

For example, I create a route

Route::get('current', function ()
{
    return URL::current();
});

And It show me :

aws connection

In local that work very fine :

local connection

Why it doesn't generate https url ? Thanks,

Ad

Answer

Elastic Beanstalk runs behind a load balancer. The load balancer proxies all of the requests to EC2. It forwards the headers to the request and as such you need to configure Symfony's Request class for it to be able to correctly interpret how the request was made.

The easiest way to to this is to use TrustedProxy by Fideloper.

Ad
source: stackoverflow.com
Ad