r/linuxadmin • • Nov 10 '25

Apache Configuration!!

I’ve hosted a Node.js WebSocket server on port 6060 behind an Apache web server. When a user visits my endpoint for example, www.mydomain.com/app/, the system assigns them a unique ID, records their username, entry time, and (eventually) their last active time.

Here’s the issue: When a user closes their browser tab, Apache receives the FIN signal immediately, but it keeps the backend connection to Node.js open for another 30–40 seconds. As a result, the “last active time” is recorded with a delay (about 35 seconds after the user actually exits).

I’ve tried enabling flushpackets on, adjusting timeout values, and other Apache settings, but nothing eliminates the delay. The root cause appears to be that Apache holds the connection open until its internal I/O timeout expires before releasing the Node backend.

Don't worry the code work perfect on localhost, so there no way solo code has a issue!

7 Upvotes

10 comments sorted by

View all comments

Show parent comment

1

u/Sufficient-Newt813 Nov 11 '25

I’m currently working with an older Apache version (2.4.6) on a remote server, and I want to get my application running properly there. On my local setup, I’m using Apache 2.4.58, which supports the proxy_wstunnel_module. Because of that, everything runs smoothly and the database updates quickly on my local server.

However, Apache 2.4.6 doesn’t support proxy_wstunnel_module, flushpackets, or a few other modern directives and paramter's. I know upgrading would solve this, but I’m trying to make it work as-is with the older version first. If that’s not realistically possible, I’ll switch to the newer release. Technically, we could just offset the exit time by 35 seconds and record it that way, but that feels like a hack - not a proper fix.

Also, about the local environment, I’m not using “localhost” in the casual sense. I’ve configured a proper local server on my Linux system, so it’s a fully functional setup, not just localhost.
Consider the version I am on remote server and localserver !

5

u/thequux Nov 11 '25

2.4.6‽ That's not old, that's ancient. It was released in July 2013, so you're running a version that's over 12 years old. There have been a lot of vulnerabilities found in Apache since, and unless you're running this on RHEL 7, you need to prioritize that upgrade immediately. Even if you are running RHEL 7, it's on extended lifecycle support, so you're paying through the nose for security updates.

My advice is, if upgrading your proxy is feasible, do that. There's nothing valuable to be learned trying to make it work with such an old version of Apache.