Random 404 erros

Since 2 months me and my team have random 404 errors on random pages. Sometimes it last few seconds, sometimes few minutes. Then we refresh the page and the page comes back as normal.

I checked the logs, server and octobercms backend but I can’t even see the 404 errors.

Could it be a route issue? Cache issue? Or anything else?

Thank you

Hi and welcome @amauryleproux

This can be caused by Apache sharing environment variables. Do you use a dedicated server to host one website, or is it sharing multiple sites?

When the 404 error is displayed, does it show using a different theme? If so, it might indicate that the database has fallen over and the configured theme (in the database) reverts to the one found in config/cms.php (in the file system).

Does it happen in production? This can be normal for some dev environments (XAMPP, Laragon, etc.), but it shouldn’t happen in a production environment.

I hope this helps.

Thank you for your help @daft.

So:

  1. We use Nginx and it’s a dedicated server (Ubuntu) hosting only our October app, no other sites
  2. 404 is in the same custom site theme.
  3. Yes, happens in production.

The randomness is the tricky part.

Does it happen in the admin panel or on front end pages?

For sure on the front end pages.
I know we had some weird redirects issue on the backend but we did not have them since a long time now.

One thing to try is to run php artisan config:cache just in case it is caused by environment variables.