Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

NoLAstNamE's avatar

nginx https force redirection

Good day everyone! I have successfully deployed my app on Laravel Forge and it's obviously not in https. I've obtained LetsEncrypt by clicking Obtain Certificate and added the below code to my AppServiceProvider.php

if (config('app.env') === 'production') {
    URL::forceScheme('https');
}

The site is not loading all the assets after adding the above code when in https, but if I access the asset with http it's loading by directly opening it. Also it's not forcing the site to https

This is what it is looks like in the browser's address bar

http://domain.com

But in console the assets are in https

https://domain.com/asset/style.css

My Site Environment

APP_URL=https://domain.com

0 likes
1 reply
NoLAstNamE's avatar
NoLAstNamE
OP
Best Answer
Level 8

My bad. I haven't successfully obtained the Let's Encrypt SSL because I did not remove the www.domain.com before clicking Obtain Certificate. After removing that, I re-obtained and now the https is working.

Please or to participate in this conversation.