Maybe you have set up rewrite to http similar to what you can do with rewrites to https from http?
Assets not being served over HTTPS
I have no idea why this has suddenly become an issue, as I don't recall coming across this problem before when using Laravel. But with my new project, when I deploy my app to my https:// domain, every {{ asset() }} and every {{ route() }} is being served over http.
My APP_URL is correctly set to https, and as I say, I don't recall ever having this issue with previous Laravel applications.
What have I done wrong?
The solution was a trusted proxies issue. You can read more here:
https://laravel.com/docs/5.6/requests#configuring-trusted-proxies
All I had to do (as an AWS Elastic Beanstalk user) was edit app/Http/Middleware/TrustProxies.php:
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array
*/
protected $proxies = '*';
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers = Request::HEADER_X_FORWARDED_AWS_ELB;
}
Now everything is fine.
Please or to participate in this conversation.