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

mvolmar's avatar

fix http https issue on aws

We've got a new project deployed to aws which works fine locally but on aws the login screen breaks due to css and js files not getting requested over https

This request has been blocked; the content must be served over HTTPS.

I've seen a number of threads that suggest adding

URL::forceScheme('https'); or \URL::forceScheme('https'); to AppServiceProvider or RouteServiceProvider will fix it, but when I test locally it breaks same way as on deploy.

I've also seen this cited as a solution: \Illuminate\Support\Facades\URL::forceScheme('https'); which also doesn't work and breaks site in local.

what am I missing here? Any help appreciated.

0 likes
10 replies
itsfg's avatar

If the page itself is loaded with https, maybe the issue is just that the links to the css and js file don't contains the httpS ?

In you config/app.php / .env your app url is with https ?

You can still link to your css/js files with regular absolute links "/like/this.css"

mvolmar's avatar

I changed it to this link rel="stylesheet" href="{{ '/css/app.css' }}" but it is still throwing the error

itsfg's avatar

One thing for sure. If you access your page with https, an absolute link like you've put should work.

Any other css, js, image... file requested without httpS ?

mvolmar's avatar

yes, what you suggested did work, tracking down another issue with an image now

1 like
mvolmar's avatar

even the route on my login page isn't picking up the https

form method="POST" action="{{ route('login') }}"

Route::post('/login', [AuthenticatedSessionController::class, 'store']) ->middleware('guest');

route('login'). is coming back as http: not https:

itsfg's avatar

The app url in your .env is in https ?

chaudigv's avatar

Which web server are you using? nginx or apace?

mvolmar's avatar

ok, so I had to fix a couple deploy issues unrelated, and then retried adding $url->forceScheme('https'); to the boot method of AppServiceProvider and its working now.

thanks for the helpful comments

Please or to participate in this conversation.