英文:
Laravel Vite assets from https
问题
Vite 在生产环境中从 http 获取资产,尽管已将 APP_URL 设置为 https://
如何在 vite 配置中解决这个问题?我不能更改 Laravel 的 AppServiceProvider 强制使用 https,因为这会引发其他问题。
我使用 @vite 指令来获取资源,如果需要的话,我可以更改它。
@vite('resources/js/app.js')
我尝试过 vite build -- --https
,但似乎不起作用。
英文:
Vite on production is taking assets from **http ** despite APP_URL is set to **https:// **
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
答案1
得分: 0
Adding ASSET_URL (with https) fixed the issue. It wasn't set at all in .env and vite decided to pull through http://.
Answering in case any useful for others.
英文:
Adding ASSET_URL (with https) fixed the issue. It wasn't set at all in .env and vite decided to pull through http://.
Answering in case any useful for others
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论