I have ran into similar issues. I ended up changing my HTML source files.
To understand let me start with the background. I have a web page where ever second I request data from the embedded server and display it. So in the _javascript_ for the web page I had a 1000ms timeout that requested new data(file). This worked great on the bench. However the customer was testing it and complaining about it being slow. As it turns out the issue was the customer had a slow laptop and when they started a zoom meeting the network traffic on the laptop went up and my device got really really slow.
What I found was happening is I would make a request for data, it would time out inside chrome which would retry the request. That is as the requests timed out in the browser it would retry, this meant as time moved forward I would start with browser trying to request one copy of data, then if that timed out it would request it again while my timer in _javascript_ also requested it again, now I had two connections for the same file on the embedded device. Then three, then four...
The solution was to change the _javascript_ such that it made request and if I did not get a response in 500ms it would time out the request, before I made a second request. This way at any time the browser would only allow one request per file. I also could increase the timeout between requests to match network speed. I found this also needed to be done with CSS files. That is sometimes I found that I would get random failure requesting files. For example at one time my Phy chip was getting too hot and causing random network failures that cause havoc on my system. I found that this would cause random failures, and retries. By having the _javascript_ control the time out on the file it helped. That is with the random failures and the time out for the http connection in lwip I would again get where I had two open connections for the same resource/file. Hence timing out on _javascript_ would send the close to the server and thus kill one connection before starting a new one.
This also leads to the other issue, when you use LWIP you have think about how the system handles multiple requests for the same resource. That is if you are sending out a file can lwip have two open connections to the file? For example two computers accessing your server at the same time. This is one reason I implemented authentication system, as it restricts the number of connections, by restricting the number of users.
Trampas