I'm currently serving a website using Express on a Raspberry Pi 4B, hooked directly into a wireless gateway via ethernet.
Unfortunately, while the website works fine most of the time, every few requests it takes twenty seconds to load whatever page you're requesting. I find this really weird, as according to the server logs, it's only taking an average of two seconds to load. Here's an example request, as recorded in the server logs:
GET /attendance 304 298.553 ms - -
GET /stylesheets/style.css 304 1.188 ms - -
GET /stylesheets/coming.css 304 1.086 ms - -
GET /javascript/jquery-3.6.1.min.js 304 1.032 ms - -
GET /javascript/dropdown.js 304 1.896 ms - -
GET /images/OA%20NSS%20Logo.png 304 1.051 ms - -
GET /images/beach.jpg 304 1.036 ms - -
GET /images/menu_hamburger.svg 304 1.040 ms - -
If I'm reading that right, the requests should have only taken a total of slightly over 1.6 seconds. However, according to my web browser's request logging that same request took a lot longer (19.79 seconds), with the main culprit being the main document (19.27 seconds). All the other stuff (pictures, stylesheets, etc.) loads in a timely manner. Here's a screenshot of the browser's logs: https://i.stack.imgur.com/iJpWJ.jpg
According to the browser, 19.11 seconds of the 19.27 seconds the main document takes to load are spent "Blocked". I'm not quite sure what this means, but it's probably significant.
Is what's slowing these requests down a problem with my code, a misconfigured network, or something else entirely?

