Laravel-Backpack / basset

Better asset helpers for Laravel apps.
MIT License
151 stars 10 forks source link

Does not work with htaccess #97

Closed alancwoo closed 9 months ago

alancwoo commented 10 months ago

When deploying Backpack 6 on a dev site that is protected with htaccess/basic-auth, basset seems not to work.

php artisan backpack:install and php artisan basset:check both fail:

Backpack Basset failed to check it's working properly.

The only solution so far has been to disable the authentication after a deploy, run php artisan backpack:install and then reenable authentication after.

promatik commented 9 months ago

Hi @alancwoo!

Yes, php artisan basset:check command will not be able to check that the assets are accessible, due to that password protection. Any way, the website should work and the assets should be cached, because @basset should always be used with https://... cdn assets, and local filesystem assets (@basset(base_path(...)), so accessing password protected assets will not happen.

By the way, you shouldn't run the install command on production, you run it locally, and deploy the files it created/changed.

You may run php artisan basset:cache to quickly cache most of the assets, you can run it locally and on the server, it will increase the performance of the first boot time (first time assets are cached).


@alancwoo, let me know if you had any issues other than the php artisan basset:check fail. Because the website should work anyways.

alancwoo commented 9 months ago

Ah thank you for the response and the tip regarding the cache! You were correct actually, I think the issue was that our deployment method was breaking the storage link, so will have to look into that. Just php artisan storage:link fixed it.