0% found this document useful (0 votes)
13 views3 pages

How To Change The Assets URL Origin Added by '@vite' Directive - Laravel - Framework Discussion #43117 GitHub

Uploaded by

Ben Onaji
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views3 pages

How To Change The Assets URL Origin Added by '@vite' Directive - Laravel - Framework Discussion #43117 GitHub

Uploaded by

Ben Onaji
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

laravel / framework Public

Code Issues 42 Pull requests 37 Discussions Actions Security 6 Insig

How to change the assets URL origin added by


@vite directive? #43117
Answered by iagobruno iagobruno asked this question in Q&A

Category
iagobruno on Jul 10, 2022
🙏 Q&A

I'm trying to deploy an app on Heroku that already uses the new Vite plugin but I'm
getting this "https required" errors: Labels

None yet

4 participants

Trying to solve the problem I noticed that the Vite manifest generated by the build
command doesn't specify the origin or the protocol of the asset urls.

But the @vite directive automatically prepends the site origin in the asset urls.
Is there any way to change this origin or even disable it to prevent these errors and
the assets being loaded?
I even looked here in the repository trying to find where is the logic that formats
these urls but I didn't find anything.

Can anyone help me or guide me in some way?

Answered by iagobruno on Aug 11, 2022

Solution

Recently the Laravel core team added an env variable to customize the assets URL
prefix.
S j t fi thi i bl i d i l
View full answer

2 comments · 3 replies Oldest Newest Top

kaozaza2 on Jul 11, 2022

Set env APP_URL to https://<full domain>

1 1 reply

iagobruno on Jul 12, 2022 Author

It was the first thing I tried but it didn't work, the assets domain doesn't
change if I change this environment variable.

iagobruno on Aug 11, 2022 Author

Solution

Recently the Laravel core team added an env variable to customize the assets URL
prefix.
So just configure this variable in your admin panel:

ASSET_URL=https://your-app.herokuapp.com
Marked as answer 7 👍 6 👎 1 🎉 2 ❤️ 6 2 replies

abhijitbcob on Feb 27, 2024


Thanks guys.

ASSET_URL this variable really saved me. our app has country prefix in the url.

❤️ 1

CLEMREP on Nov 10, 2024


But if you have subdomain portal.your-app.com and your-app.com, what is
the way to solve the problem ?

Answer selected by iagobruno

You might also like