Skip to content

"Proxy Error: The Proxy Server Received an Invalid Response From an Upstream Server" (Apache 502)

Apache's mod_proxy reporting the server behind it did not answer properly. What each Reason line means, and the admin fixes.

HProxy TeamAugust 24, 2026Updated October 23, 20269 min read

\"Proxy Error: The Proxy Server Received an Invalid Response From an Upstream Server\" (Apache 502)

The page is text on white, in the default browser font, and it has barely changed in years. It says "Proxy Error", then "The proxy server received an invalid response from an upstream server". Since Apache 2.4.41 the next line reads "The proxy server could not handle the request", followed by a line that begins "Reason:". Older servers also printed the method and the path there; Apache took them out in 2019, in its fix for CVE-2019-10092. A footer names Apache and the site's host name.

People who see it search for the first two lines. Many then look for the proxy setting on their own computer, because the page said "proxy server". That search is a dead end. The proxy in the message belongs to the website. It is Apache, the web server, working as a reverse proxy: it receives your request and forwards it to another program, the "upstream server", which builds the page. When that program fails to answer properly, Apache has nothing to show you, so it shows this. Your proxy settings, your VPN and your browser had no part in it.

The message is searched far more often than the setting behind most of its fixes. Keyword Planner counts about 1,900 searches a month worldwide for the message itself, against 210 for ProxyTimeout.

Monthly Google searches for Apache's 502 message and for ProxyTimeout, worldwide, October 2025 to September 2026
  • the proxy server received an invalid response from an upstream server
  • proxytimeout
The message drew about 9 times the searches for ProxyTimeout, and peaked at 3,600 in September 2026.
Source: Google Keyword Planner, worldwide monthly searches, read October 23, 2026 · hproxy.comProxy.

Which proxy, and which server?

Two proxies exist in this story, and only one of them is yours. A forward proxy is something you configure on your device so that your requests go out through it. That is what a proxy service sells, and what the settings pages on your computer are about. A reverse proxy is something a website runs in front of itself, invisible to you, so that one public server can hand requests to whatever runs behind it. Apache's mod_proxy module is a common reverse proxy, and this page is its failure message. Our explainer on forward versus reverse proxies covers the difference in depth.

Where the failure is: between the site's Apache and the site's backend
  1. Your browser

    request arrives fine

  2. Site's Apache (reverse proxy)

    forwards to the backend

  3. Backend application

    no valid answer = Proxy Error

Source: Apache mod_proxy 502 behavior · hproxy.comProxy.

The request reached the site. Apache accepted it, which is why you got a page at all rather than a timeout. Apache then asked the backend, and the backend crashed, hung past the time limit, closed the connection, or answered with something that was not valid HTTP. Apache reports each of those with a Reason line that says which.

What does the Reason line mean?

We read the Reason lines straight from Apache's source, the 2.4.x branch, on October 23, 2026. Five of them go out with a 502, the page this article is about.

The Reason lines Apache 2.4 writes with a 502, and what each one means

Reason lineWhat happened behind the siteTypical cause
Error reading from remote serverThe backend accepted the request, then closed or went silent before a full responseA crash mid-request, a request longer than the proxy timeout, or a reused connection the backend had already dropped
Corrupt status line returned by remote serverThe backend's first line looked like HTTP but named a version other than 1.x, or ran longer than Apache acceptsA broken or misconfigured backend
Malformed connection headerThe backend's Connection header could not be parsedA broken or hand-built response from the application
Unexpected UpgradeThe backend switched protocols to something the request did not ask forA WebSocket or other upgrade answered for the wrong protocol
Too many interim responses from origin serverThe backend sent more interim (1xx) answers than Apache acceptsA misbehaving backend that keeps answering 100 Continue

Apache httpd 2.4.x source, modules/proxy/mod_proxy_http.c, read October 23, 2026

Two Reason lines that people often pair with this page go out with a different status. "DNS lookup failure for:" and "Error during SSL Handshake with remote server" come as a 500 Proxy Error. That page shows "The proxy server could not handle the request" and the Reason, without the line about an upstream server.

Our console: the Reason lines in Apache httpd 2.4.x's proxy code, each with the status it goes out with. Five go out with a 502 (error reading from remote server, corrupt status line, unexpected upgrade, malformed connection header, too many interim responses), two with a 500 (DNS lookup failure, SSL handshake), four with a 400, one with a 403 and one with a 503.
Printed on our own machine on October 23, 2026, by a short script over Apache's 2.4.x source files. The file and line of each Reason sit on the right.

"Error reading from remote server" is the one most people see, and it is the least specific. It says the backend stopped talking, and the why lives in the backend's own log, on the site's side.

What can I do as a visitor?

The honest list is short.

  1. Wait a minute and reload. Backends restart, deploys roll and single requests time out. Many of these pages are gone on the second try.
  2. Try another page on the site. If the home page loads and one action fails, such as a search, a report or an export, that action takes longer than the site's backend allows. The site's operators need to know which one.
  3. Leave your own settings alone. Your proxy configuration, VPN, DNS, cache and cookies play no part. If someone tells you to reset your proxy settings for this page, they have confused the two kinds of proxy.
  4. Tell the site, with the time and the URL, if the page persists beyond a few minutes. The footer names the server and port, which tells them where it came from.

How do I fix it if I run the server?

Here the page helps, because the Reason line and the error log narrow the cause quickly.

Confirm the backend is up and reachable from Apache. On the Apache host, request the backend directly at the address in your ProxyPass line, for example curl -v http://127.0.0.1:8080/some/path. A refused connection means the backend is not listening, and a hang means it listens without answering. An answer here while Apache still fails points at the proxy configuration.

Read both logs for the same request. Apache's error log carries the Reason and the backend address. The backend's log carries the exception, the crash or the slow query. "Error reading from remote server" next to a worker killed for memory, or a request that took 90 seconds, is a complete diagnosis.

Align the timeouts. Apache's documentation describes ProxyTimeout as the "Network timeout for proxied requests", and its default is the value of Timeout. The timeout= parameter on a ProxyPass line sets the same limit for one backend. If the application may run longer than that, every slow request produces this page. Raise the proxy timeout for the slow location, or lower the application's limit so it fails with its own error page first. A dedicated <Location> with a longer timeout= is cleaner than a global change.

Handle backends that close idle connections. mod_proxy_http reuses connections to the backend. A backend that closes an idle connection without Apache noticing produces "Error reading from remote server" on the next request through it. Two environment variables address this. proxy-nokeepalive "Forces the proxy to close the backend connection after each request". proxy-initial-not-pooled keeps a client's first request off pooled connections, which, in Apache's words, "avoids the "proxy: error reading status line from remote server" error message" caused by that race. disablereuse=On on the ProxyPass line does the same for one backend.

Set up HTTPS to the backend. Proxying to an https:// backend needs SSLProxyEngine On, which is off by default. By default Apache asks for no valid certificate chain from the backend (SSLProxyVerify none). It does check that the certificate names the host in your ProxyPass address (SSLProxyCheckPeerName on). To demand a valid chain, set SSLProxyVerify require with SSLProxyCACertificateFile. A handshake failure shows as the 500 Reason line above.

Check that the backend speaks HTTP. A ProxyPass line that points at a port running another protocol, such as a database, does not always produce this page. Apache passes on a reply that does not start like an HTTP status line as an old HTTP/0.9 response, so the visitor gets raw bytes with a 200 status. A port that closes or stays silent gives "Error reading from remote server" instead, and the error log shows AH01102: error reading status line from remote server.

Preserve the host if the backend routes by it. ProxyPreserveHost On passes the original Host header through, which some applications need before they answer at all.

How does this differ from the other gateway errors?

Apache's Proxy Error page is a 502 with a Reason line, and nginx reports the same class of failure as a bare "502 Bad Gateway". A 504 means the front server waited the full timeout and got nothing. A 503 means a server answered that it cannot serve right now. Our guides to 502 Bad Gateway through a proxy, 504 Gateway Timeout and 503 Service Unavailable cover those. They include the one case where the visitor's own proxy is the cause: a forward proxy you configured yourself, where the fix is a different exit.

Who fixes what?

The proxy server in this message is the website's own Apache, the upstream server is the program behind it, and the failure is between the two. Visitors reload and move on. Administrators read the Reason line, request the backend from the Apache host, align the timeouts, and stop reusing connections to a backend that drops them.

What we could not check

  • We did not run Apache. Every Reason line and default on this page comes from Apache's source and documentation, read on October 23, 2026, and an older or patched build can differ.
  • We could not see any site's logs, so the typical causes in the table come from the code and the documentation, rather than from counting real failures.
  • Apache changes between releases. This page is due for a check by January 23, 2027.

Sources

Frequently asked questions

What does the proxy server received an invalid response from an upstream server mean?

The website runs Apache as a reverse proxy in front of the application that builds its pages, and that application did not give Apache a proper answer. Apache reports it as a 502 with this page. The proxy server in the message is the site's own Apache. Nothing on your computer or network caused it.

Does this error have anything to do with my proxy or VPN?

No. The word proxy refers to the site's reverse proxy, the Apache server that forwards requests to the site's backend. A visitor with no proxy configured at all sees the identical page. Switching your VPN off or changing proxy settings changes nothing here, because the failure is between two machines that both belong to the site.

What does Reason: Error reading from remote server mean?

Apache connected to the backend and sent the request, and then the backend closed the connection or went silent before a complete response. The usual causes are a backend process that crashed mid-request, a request that ran longer than Apache's proxy timeout, or Apache reusing a kept-alive connection the backend had already closed. In Apache's own code it is one of five Reason lines that go out with a 502.

What can I do as a visitor?

Very little, and that is honest rather than dismissive. Wait a minute and reload, since many of these are backend restarts or a single slow request. Try another page on the same site. If only one page or one action fails, that request exceeds the backend's time limit. If the whole site fails for more than a few minutes, a note to the site with the time and the URL helps.

How does a server administrator fix it?

Confirm the backend is running by requesting the address in the ProxyPass line directly from the Apache host. Read the backend's own log for the failing request. Align the timeouts so the application gives up before Apache's ProxyTimeout, or raise the timeout for slow endpoints. For backends that close idle connections, set proxy-nokeepalive or proxy-initial-not-pooled, or disablereuse on the ProxyPass line.

Is this the same as 502 Bad Gateway from nginx?

Same status code, same class of failure, different software. nginx reports it as a plain 502 Bad Gateway page. Apache's mod_proxy adds a Reason line, which narrows the cause. Both mean the front server could not get a valid answer from the server behind it.

Get proxies that are alive right now

Our free proxy list re-checks every exit every few minutes across 100+ countries, with a live last-checked time, so you copy IPs that worked moments ago, not a stale text dump. When the location has to survive a real check, the paid network holds up.

129M+ proxy checks run · 100+ countries · HTTP / HTTPS / SOCKS · re-checked every few minutes · no signup

HProxy.

Honest guides and comparisons on proxies, scraping and staying unblocked, from the team that runs the network.

RSS feed