2

I'm using Apache + mod_proxy for providing a chat application with Ejabberd. It's using Bosh (XMPP over HTTP).

The issue is when a user closes its browser, Apache keeps the connection open with the back-end server for a while (about 1 minute).

It annoys me because Ejabberd can realize that the user is gone only when the socket is closed... so the user's interlocutor doesn't know what's happening during that time + Ejabberd's own timeout. I can change Ejabberd's timeout, but I couldn't figure how to reduce the closing time on Apache side.


See netstat's output before the browser is closed :

Browser -> Apache mod_proxy

tcp        0      0 127.0.1.1:80            127.0.0.1:52361         TIME_WAIT
tcp        0      0 127.0.1.1:80            127.0.0.1:52380         ESTABLISHED
tcp        0      0 127.0.0.1:52380         127.0.1.1:80            ESTABLISHED

Apache mod_proxy -> Ejabberd

tcp        0      0 0.0.0.0:5280            0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:5280          127.0.0.1:40972         ESTABLISHED
tcp        0      0 127.0.0.1:40953         127.0.0.1:5280          TIME_WAIT
tcp        0      0 127.0.0.1:40972         127.0.0.1:5280          ESTABLISHED

And after the browser is closed, during dozens of second to about 1 minute...

Browser -> Apache mod_proxy

tcp        0      0 127.0.1.1:80            127.0.0.1:52361         TIME_WAIT
tcp        1      0 127.0.1.1:80            127.0.0.1:52380         CLOSE_WAIT
tcp        0      0 127.0.0.1:52380         127.0.1.1:80            FIN_WAIT2

Apache mod_proxy -> Ejabberd

tcp        0      0 0.0.0.0:5280            0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:5280          127.0.0.1:40972         ESTABLISHED
tcp        0      0 127.0.0.1:40953         127.0.0.1:5280          TIME_WAIT
tcp        0      0 127.0.0.1:40972         127.0.0.1:5280          ESTABLISHED

My Apache configuration :

<VirtualHost *:80>
    ProxyRequests On
    ProxyPass /http-bind/ http://localhost:5280/http-bind/

    ServerName desktop
    <Proxy *>
            Order deny,allow
            Allow from all
    </Proxy>

    RewriteEngine Off

    [...]
</VirtualHost>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.