Question: NGINX SSL reverse proxy error: recv() failed (104: Connection reset by peer) while reading response header from upstream
Applicable to:
SymptomsMultiple nginx errors similar to the following are found in /var/www/vhosts/example.com/logs/proxy_error_log:
2022/11/28 15:08:12 [error] 2680#0: *636733 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 203.0.113.2, server: example.com, request: "POST /wp-comments-post.php HTTP/1.0", upstream: "http://203.0.113.1:7080/wp-comments-post.php", host: "example.com", referrer: "http://example.com/how-to-test/"
2022/11/28 15:42:35 [error] 2680#0: *649874 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 203.0.113.2, server: example.com, request: "POST /wp-comments-post.php HTTP/1.0", upstream: "http://203.0.113.1:7080/wp-comments-post.php", host: "example.com", referrer: "http://example.com/how-to-test/"
2022/11/28 15:45:50 [error] 2680#0: *651394 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 203.0.113.2, server: example.com, request: "POST /wp-comments-post.php HTTP/1.0", upstream: "http://203.0.113.1:7080/wp-comments-post.php", host: "example.com", referrer: "http://example.com/how-to-test/"
2022/11/28 16:58:16 [error] 2680#0: *683892 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 203.0.113.2, server: example.com, request: "POST /wp-comments-post.php HTTP/1.0", upstream: "http://203.0.113.1:7080/wp-comments-post.php", host: "example.com", referrer: "http://example.com/how-to-test/"
2022/11/28 15:08:12 [error] 2680#0: *636733 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 203.0.113.2, server: example.com, request: "POST /wp-comments-post.php HTTP/1.0", upstream: "http://203.0.113.1:7080/wp-comments-post.php", host: "example.com", referrer: "http://example.com/how-to-test/"
2022/11/28 15:42:35 [error] 2680#0: *649874 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 203.0.113.2, server: example.com, request: "POST /wp-comments-post.php HTTP/1.0", upstream: "http://203.0.113.1:7080/wp-comments-post.php", host: "example.com", referrer: "http://example.com/how-to-test/"
2022/11/28 15:45:50 [error] 2680#0: *651394 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 203.0.113.2, server: example.com, request: "POST /wp-comments-post.php HTTP/1.0", upstream: "http://203.0.113.1:7080/wp-comments-post.php", host: "example.com", referrer: "http://example.com/how-to-test/"
2022/11/28 16:58:16 [error] 2680#0: *683892 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 203.0.113.2, server: example.com, request: "POST /wp-comments-post.php HTTP/1.0", upstream: "http://203.0.113.1:7080/wp-comments-post.php", host: "example.com", referrer: "http://example.com/how-to-test/"
CauseThis error can appear due to the use of the Nginx reverse proxy web server without ensuring that you are passing your SSL when proxying all connections.
Resolution1. Log into Plesk
2. Go to
Domains > example.com > Hosting & DNS > Apache & nginx Settings
3. Add the following line in
Additional nginx directives
proxy_ssl_server_name on;
4. Scroll down and press
OK to apply the changes.
If this additional setting is needed for several domains, you can apply it by using the information in the following article:
How to update the "Additional nginx directives" field for all/several domains in Plesk – Plesk
Additional information
NGINX - Alphabetical index of directives