F
Filament16mo ago
rabol

Getting 404 when loading assets

Hi My Filament admin panel has been working for some time, but just today I get a 404 when loading the assets If i try to access the assets directly https://xxxx/filament/assets/app.css?id=ceb9a486dfc44ebe8adaa3bd510821e8 I get the the css but when loading the panel the css is not loaded and in the console I can see 404 errors Yes, I have found other discussions here and it does not solve my issue
33 Replies
josef
josef16mo ago
Anything else in the console? What did you change last before it stopped working? Any URL (sub)domain changes?
rabol
rabolOP16mo ago
Not that I can think of the same code is deployed to a production server and does not have the issue the 'funny' thing is that if I access the assets directly I can see it
josef
josef16mo ago
can you post a screenshot of the console and errors? seems to be something with your local dev setup then
rabol
rabolOP16mo ago
and no, there only the 404 reagrding the assets in the console it's not on local local is working fine
rabol
rabolOP16mo ago
josef
josef16mo ago
Weird, how does it look when you open the asset directly? same url?
josef
josef16mo ago
what's the url that includes those assets where it doesnt work?
josef
josef16mo ago
That's weird ... any custom middlewares?
rabol
rabolOP16mo ago
If I do a 'view source' on the page that get the 404 and click on the link to the assets, I get the assets
josef
josef16mo ago
yeah same, it does show the file content in the response tab as well
rabol
rabolOP16mo ago
yes, but they have been there for a very long time tried to uncomment them same result
josef
josef16mo ago
Ok, no idea really, sorry. Just ... did anything, anything at all change, before it stopped working? server configuration, new code, an update ... anything? things mostly never just happen, and people think whatever they did can't be the reason, but something must habve happened somewhere
rabol
rabolOP16mo ago
no code changes to the filament part, no server changes I agree that something must have happend I have to look at it at at later thanks for your input or maybe it's time for another solution
josef
josef16mo ago
sure! if you find the cause, or need any more help,let me know maybe try just restarting the server to see if anything changes, and try to reproduce locally
rabol
rabolOP16mo ago
done 10 restart and it does not happen locally or in production
josef
josef16mo ago
I'd probably start dd() debugging the filament asset controller
rabol
rabolOP16mo ago
I did a Log::info in several places Funny thing is... I just looked at the HTML that is generated local and on the test server and It's not equal e.g. local I have
<!-- Livewire Styles -->
<style >
[wire\:loading], [wire\:loading\.delay], [wire\:loading\.inline-block], [wire\:loading\.inline], [wire\:loading\.block], [wire\:loading\.flex], [wire\:loading\.table], [wire\:loading\.grid], [wire\:loading\.inline-flex] {
display: none;
}

[wire\:loading\.delay\.shortest], [wire\:loading\.delay\.shorter], [wire\:loading\.delay\.short], [wire\:loading\.delay\.long], [wire\:loading\.delay\.longer], [wire\:loading\.delay\.longest] {
display:none;
}

[wire\:offline] {
display: none;
}

[wire\:dirty]:not(textarea):not(input):not(select) {
display: none;
}

input:-webkit-autofill, select:-webkit-autofill, textarea:-webkit-autofill {
animation-duration: 50000s;
animation-name: livewireautofill;
}

@keyframes livewireautofill { from {} }
</style>
<!-- Livewire Styles -->
<style >
[wire\:loading], [wire\:loading\.delay], [wire\:loading\.inline-block], [wire\:loading\.inline], [wire\:loading\.block], [wire\:loading\.flex], [wire\:loading\.table], [wire\:loading\.grid], [wire\:loading\.inline-flex] {
display: none;
}

[wire\:loading\.delay\.shortest], [wire\:loading\.delay\.shorter], [wire\:loading\.delay\.short], [wire\:loading\.delay\.long], [wire\:loading\.delay\.longer], [wire\:loading\.delay\.longest] {
display:none;
}

[wire\:offline] {
display: none;
}

[wire\:dirty]:not(textarea):not(input):not(select) {
display: none;
}

input:-webkit-autofill, select:-webkit-autofill, textarea:-webkit-autofill {
animation-duration: 50000s;
animation-name: livewireautofill;
}

@keyframes livewireautofill { from {} }
</style>
on the test server i don't have the somment and the style is on one line should not make a difference, but I wonder why the HTML is different I have added a Log::error($file) in the assets controller and i only get 3 hit's
[2023-08-24 08:54:32] production.ERROR: app.css
[2023-08-24 08:54:32] production.ERROR: app.js
[2023-08-24 08:54:32] production.ERROR: invaders-filament-jsoneditor.js
[2023-08-24 08:54:32] production.ERROR: app.css
[2023-08-24 08:54:32] production.ERROR: app.js
[2023-08-24 08:54:32] production.ERROR: invaders-filament-jsoneditor.js
Dennis Koch
Dennis Koch16mo ago
Might still be related to your subdomain. Since it's working on production without a subdomain 🤔
rabol
rabolOP16mo ago
well.. maybe.... but why now ? It's been working for 6-7 months I absolutely agree that something must have changed, but I cannot figure out what, meaning everything on the site is working except filament panel If I look at the servers error.log for I can see it tries to access /var/www/xxx/current/public/filament/assets/app.js and that gives an error and I agree... the file does not exists in that path
Dennis Koch
Dennis Koch16mo ago
So the test system is also not new? It has worked before?
and I agree... the file does not exists in that path
Yeah, the files are served through Laravel. But the same is true for Livewire, which also works.
rabol
rabolOP16mo ago
yes, the test system has been working for 5-6 months Yes, I use livewire on the front end and that works fine I don't go to the admin panel on the test system on a daily bases so it could be that it's not been working for 2-3 week, however the code fir filament has not been changed for months
awcodes
awcodes16mo ago
Make sure the server config wasn’t changed to serve static files directly. If so you’ll need to add a block to tell the server to serve anything under the filament path with php instead.
Dennis Koch
Dennis Koch16mo ago
But that would also apply to Livewire. Unless Livewire.js was published to public folder? 🤔 @rabol Is the Livewire file inside the public folder or also served via Laravel?
rabol
rabolOP16mo ago
I had to publish it today using the php artisan livewire:publish --assets command livewire.js is in /public/vendor/livewire/livewire.js but.... there is a route and if I try t access the file directly it works
awcodes
awcodes16mo ago
Just recommending what I’ve had to do one some of our servers.
rabol
rabolOP16mo ago
sure... I'm not complaining 🙂
rabol
rabolOP16mo ago
Filament
Fix Filament assets not loading in Nginx by Ida Bagus Gede Pramana ...
Filament is a collection of tools for rapidly building beautiful TALL stack apps, designed for humans.
rabol
rabolOP16mo ago
like this ?
awcodes
awcodes16mo ago
Yep It is weird though that the server would update its own config on this though. Has any one else been doing anything with the server.?
rabol
rabolOP16mo ago
but the above has never been in the config before as I have never had any issues one sec..... i recently added this to the server config:
location ~* \.(js|css|jpg|jpeg|png|gif|js|css|ico|swf)$ {
expires 1y;
etag off;
if_modified_since off;
add_header Cache-Control "public, no-transform";
}
location ~* \.(js|css|jpg|jpeg|png|gif|js|css|ico|swf)$ {
expires 1y;
etag off;
if_modified_since off;
add_header Cache-Control "public, no-transform";
}
` the above was the issue ....
awcodes
awcodes16mo ago
Makes sense.
Want results from more Discord servers?
Add your server