A residential proxy 504 gateway timeout almost always means one dead IP, not a dead gateway. The seller's gateway took your request, tried to send it through the home connection your session id points at, and heard nothing back in time. On a sticky session the id is the IP, so asking again with the same id asks the same dead connection again. The fix is a new session id, not a longer wait.

We learned this from a bug report with a screenshot. A launch in Mosaic had been refused four times with "Proxy returned HTTP 504", while the provider's own status dot sat green a few centimetres above it. Both readings were true, and the reason is the whole of this page.

What a residential proxy 504 gateway timeout means

HTTP defines 504 as a server "acting as a gateway or proxy" that "did not receive a timely response from an upstream server it needed to access in order to complete the request" (RFC 9110, section 15.6.5). With a residential proxy there are two upstreams: the household's connection, then the website. Either can be the one that went quiet.

The gateway itself is rarely the problem, since it answered you with a status code. What failed is somewhere behind it, and with a residential pool the weakest link is the home connection: a router switched off, a phone that left the Wi-Fi, a peer the seller can no longer reach.

What we measured

To find out whether retrying helps, we went looking for a dead IP on purpose. We made forty fresh sessions at one residential seller and sent each a request. The twenty-ninth failed. Then we retried it the way our own check did at the time, three more times on the same id, and tried a couple of fresh ids beside it:

session 889053 → 504    the attempt that failed
session 889053 → 504    retry 1
session 889053 → 504    retry 2
session 889053 → 504    retry 3

session 758767 → 504    a fresh one, unlucky as well
session 195609 → 200
session 131797 → 200

Four out of four on the dead session, and a fresh id answered on the second try. A 504 there was a property of the session, not of the gateway. The provider's dot was green because the check behind it gets its own session to ask, a different IP, and a working one.

Paste one proxy line. Every profile gets its own IPIn Mosaic: A new IP for every profile. One proxy account, a separate IP for every profile. Free covers 3 profiles with no card, and Pro is $25 a month for any number of them.

How it works: A new IP for every profile

The fix, by hand

  1. Change the session id in your proxy line. Each seller has its own spelling: sessid- in the username at Oxylabs, -session- at Bright Data, _session- in the password at IPRoyal. Any new string works; keep the country and city tokens as they were. (Rotating vs sticky proxies has the examples.)
  2. Test the new line before the browser uses it. One curl through it to an HTTPS address is enough to see an IP come back.
  3. If every new session fails too, the problem is not one IP. Check the country or city you asked for (a narrow location can have few homes online), check your plan's traffic balance in the seller's dashboard, and try a different target site to rule out the site itself.
  4. If only one site fails on every session, the site is slow or refusing that seller's pool. That is not something a session id changes.

How to test a proxy before using it has the full test, with the commands.

Why some sellers answer 502 instead

Not every seller lets a dead session sit. Oxylabs documents that when an proxy server drops, a normal sessid session "will automatically rotate to a new IP to fulfill your request", and it offers sessid_oneip for when you would rather get an error than a new address (Oxylabs session control, read 2 November 2026). Bright Data's -const option does the same job on its side, returning an error instead of moving the session to a new peer (Disable peer rotation). So whether you see a 504, a 502, or a quiet change of address depends on the seller and the mode, and the quiet change is the one to worry about for a signed-in account.

Should the account move?

A new session is a new address. With the same country or city in the line it stays in the same place, but a site that has seen the account on one IP will see it on another. For a profile that only reads public pages that does not matter. For an account a person signs in to every day, it is a small change, and much smaller than a session that fails every launch until someone notices.

There is one case where we would not rotate: when the session id was chosen on purpose, for example because an account has always signed in from that address. There, a dead IP is a fact to report, and a quiet move would leave the profile somewhere it was never asked to be.

How Mosaic handles a 504

After that report, a failure costs a different IP rather than a longer wait, at all three places Mosaic makes a session: launching a profile, checking a provider, and creating profiles from one.

  • A session Mosaic made from a provider is replaced with a new one using the same pick, so a country you chose is still the country you get. The new session is checked, and if it answers, it is written back to the profile so the next launch does not start on the dead one.
  • A proxy set to get a new IP on every launch (New exit on every launch) already gets a fresh session each time, so it is rotated too, and nothing is written back.
  • A session you pinned by hand is never moved. The launch is refused, and the refusal quotes the gateway's own reason, such as "Proxy returned HTTP 504", followed by why the browser was not opened anyway: it would fall back to your computer's own address.
A proxy provider in Mosaic: one proxy line that makes a separate session for every profile
The provider record shows sessions tried and the last IP

We proved it against a stub gateway that returns 504 for one named session and forwards every other. The profile holding the killed session started on a new session id, and the log said the first session had not answered and the launch had retried on a fresh one. A profile with a hand-pinned session killed the same way was refused, which is the correct answer. How providers make and replace sessions is on the proxy providers page.