Connection Reset by Peer Using Apache as Reverse Proxy

apache-2.4Apache2reverse-proxyUbuntu

I've installed Transmission daemon on machine #0(Ubuntu 16.04.5, native), and Apache2(Apache/2.4.18) on machine #1(Ubuntu 16.04.5, on XCP-NG 75). Apache is now reverse-proxying transmission for adopting TLS to transmission rpc.

Wherever I connect to transmission via apache, it continues returning 'Connection reset by Peer' for few minutes interval.

I can sure this is not a problem of network, since SSH connection from My PC to machine #1, and machine #1 to machine #0 both remains stablized.

This is a config for transmission vHost.

<IfModule mod_ssl.c>
    <VirtualHost *:443>
        SSLEngine on
        SSLCertificateFile [A Certificate File]
        SSLCertificateKeyFile [A Certificate Key File]
        SSLCertificateChainFile [A Certificate Chain File]
        ServerName [Hostname]

        ProxyRequests Off
        ProxyPass / http://[Address to machine #0]:9091/
        ProxyPassReverse / http://[Address to machine #0]:9091/
        <Location "/">
            AuthType Basic
            AuthName "Transmission"
            AuthUserFile [Authentication File]
            Require valid-user
        </Location>
    </VirtualHost>
</IfModule>  

Which makes this kind of problem? and how should I fix it?

Best Answer

I've (finally) joined the StackExchange community to help you, as nobody has answered yet.
I was facing the same issue today, and it looked definitely related to the Apache SSL info we could notice within verbose logs :

[ssl:info] [...] The timeout specified has expired: [...] SSL input filter read failed.

So a "solution" (mostly a "workaround" IMHO) is proposed here.

Here is a blog post I've written about this very setup : link.

Bye 👋

PS : In my specific case, SetEnv nokeepalive sufficed.


TL;DR

Try adding SetEnv nokeepalive ssl-unclean-shutdown to your VHOST configuration.