Support the ongoing development of Laravel.io →
posted 8 years ago
Blade
Last updated 1 year ago.
0

I guess I could put APP_SECURE=true or APP_SECURE=false in my .env file, and reference that in every single asset call ... that might be the best I can do. Doesn't feel elegant and Laravel-esque, though.

0

Try putting HTTPS=on or HTTPS=off in your .env file. No other editing should be required.

Last updated 7 years ago.
0

Maybe it will be helpful. Laravel automatically detect HTTPS and make asset schema by request protocol (just checks $_SERVER['HTTPS']). However, I faced the problem, that didn't work in my hosting. It was caused by using combination of apache and ngnix that changes HTTP headers. As a result, $_SERVER['HTTPS'] was renamed to $_SERVER['HTTP_HTTPS'], so Laravel couldn't detect HTTPS. In this case, you can write $_SERVER['HTTPS'] via PHP before detection (e.g. in public/index.php) or set schema via app('url')->forceSchema(...).

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.