Laravel Vite 从 https 获取资产

huangapple go评论61阅读模式
英文:

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:// **

Laravel Vite 从 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

huangapple
  • 本文由 发表于 2023年6月26日 18:27:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/76555816.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定