Laravel will just read and use the protocol used to access the site.
Do you use a proxy that could of sent http instead for a request? Was the asset rendered via JS or anything other than blade {{ asset() }} helper?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello
i recently had an issue where my assets were not loading correctly on my server which is in https. the assets url were loading in http.
the solution i found was to add in the appserviceprovider
\URL::forceSchema('https');
this solved the problem.
However, in the local development, after creating a self-signed certificate, my assets were being correctly generated, that is in https.
This solution seems a little bit hacky. I was wondering what do you guys think?
solution link: https://laracasts.com/discuss/channels/laravel/force-ssl-secure-routes-in-laravel-52?page=1
To close this subject, the environment was using a load balancer: https://cloud.google.com/compute/docs/load-balancing/http/
The client and the load balancer were talking in https However, the load balancer and the vm instance where my application was were talking in http causing the above mentioned error.
Please or to participate in this conversation.