Apache has decided websites shouldn't have their own /javascript (Shallow Thoughts)

Akkana's Musings on Open Source Computing and Technology, Science, and Nature.

Sat, 27 Sep 2025

Apache has decided websites shouldn't have their own /javascript

Someone sent me an alert that my Galilean Jupiter's moons simulation and SatSat Saturn's moons simulation pages weren't working.

Sure enough, they weren't. The error console said Loading failed for the script with the name of a calendar widget I use, along with the CSS it uses, both loaded from a directory inside /javascript on my website, the same website where the moon simulations are running.

I checked the logs: sure enough, references to those files were returning 404 in the access log, with nothing at all in the error log. The files were clearly there, and world readable, so it wasn't a permissions problem. Evidently there had been some weird change in Apache pulled in in the Debian Trixie upgrade.

(Aside: Trixie: Worst. Upgrade. Ever. Dovecot, the IMAP server, changed its configuration completely — without any upgrade help for the old configuration — so that after a day of struggling with trying to get Dovecot's SASL working again with postfix, I gave up and, after two decades of self-hosting my own email, moved my mail offsite to a mail hosting service. Meanwhile, Postgresql offered to upgrade existing clusters, but the upgrade didn't work (though it gave no errors), so I had to spend another day figuring out how to create a new postgresql 17 database, import an NMBillTracker backup and point Flask at it. The BillTracker seems to be working again, in time for this year's special session that starts Oct 1. I'm still working up the nerve to delete the various older database versions and postgres 15. On the bright side, now I know that my database backups work, which I wasn't entirely confident about before.)

Back to the Apache problem: it took a ridiculous amount of searching before I finally found the culprit — because the critical element was the directory in which I'd placed the widget. Apparently Apache has decided that websites shouldn't have their own /javascript directories any more. Instead, it has a mechanism called javascript-common in which any reference to /javascript on a website actually goes to /usr/share/javascript instead of the website's own /javascript (so all websites hosted on a given server must share /javascript). By default, with absolutely no indication given in the error log when this leads to a 404.

The fix (from the Stack Overflow thread linked above) was

# a2disconf javascript-common
# systemctl reload apache2
(not a2disconfig as suggested in the stackoverflow link; apparently it's named dfiferently on Debian-based systems).

Though perhaps a better fix is

# apt-get remove javascript-common

I'm writing this up in the hope that it will increase the search-engine-fu for other people who hit this problem.

Tags: , , , ,
[ 13:29 Sep 27, 2025    More tech/web | permalink to this entry | ]

Comments via Disqus:

blog comments powered by Disqus