Reputation: 1818
Is there a way so all route()
and url()
can be overridden to force serve https URLs if the page loaded via https?
We're currently using cloudflare and it already converts http to https but for some reason, when you visit e.g. https://www.website.com/some-page, the generated URLs via route()
and URL()
aren't automatically converted from http to https. is there a way so I can force the schema to https?
Upvotes: 2
Views: 2162
Reputation: 1559
I used below code and it's working for me:
if (!\App::environment('local')) {
\URL::forceSchema('https');
}
Add this code in Path: \app\Providers\AppServiceProvider.php boot function
replace APP_ENV=local to APP_ENV=production on root .env file.
Upvotes: 3