Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Vite assets from https

Vite on production is taking assets from http despite APP_URL is set to https://.

enter image description here

How to resolve this in the Vite config? I can't change Laravel AppServiceProvider to force to use https because this would cause other issues.

I use @vite directive to get resources, I can change that if needed:

@vite('resources/js/app.js')

I tried vite build -- --https but this doesn't seem to work.

like image 369
Piotr Migdał Avatar asked Sep 16 '25 12:09

Piotr Migdał


1 Answers

Adding ASSET_URL (with https) fixed the issue. It wasn't set at all in .env and Vite decided to pull through http://.

like image 141
Piotr Migdał Avatar answered Sep 19 '25 06:09

Piotr Migdał