# Residential proxy 504 gateway timeout

> A residential proxy 504 gateway timeout usually means one dead session, not a dead gateway. Retrying the same session id fails; a new one usually works.

Source: https://mosaicbrowser.com/guides/residential-proxy-504-gateway-timeout

## Residential proxy 504 gateway timeout: why and the fix

A 504 gateway timeout from a residential proxy means the seller's gateway could not get an answer from the home connection your session id points at. On a sticky session that IP stays dead, so retrying the same id fails again; change the session id and the next IP usually answers.

![504: Rotate the session, don't retry it, beside a screenshot: a proxy provider in Mosaic: one proxy line that gives every profile a separate session](https://mosaicbrowser.com/covers/residential-proxy-504-gateway-timeout.webp)

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](https://www.rfc-editor.org/rfc/rfc9110#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.

Mosaic is a desktop app

Email yourself the link and open it on your computer.

[How it works: A new IP for every profile](https://mosaicbrowser.com/features/proxy-providers)

## 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](https://mosaicbrowser.com/guides/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](https://mosaicbrowser.com/guides/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](https://developers.oxylabs.io/products/proxies/residential-proxies/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](https://docs.brightdata.com/api-reference/proxy/keep_same_peer_in_session)). 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](https://mosaicbrowser.com/shots/provider-mint.png)
*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](https://mosaicbrowser.com/features/proxy-providers).

## Sources

1. [IPRoyal Docs: Residential proxy rotation](https://docs.iproyal.com/proxies/residential/proxy/rotation), read November 2, 2026
2. [Bright Data Docs: Residential products FAQ](https://docs.brightdata.com/products/residential/faqs), read November 2, 2026
3. [RFC 9110: HTTP Semantics, 504 Gateway Timeout](https://www.rfc-editor.org/rfc/rfc9110#section-15.6.5), read November 2, 2026
4. [Bright Data Docs: Disable peer rotation](https://docs.brightdata.com/api-reference/proxy/keep_same_peer_in_session), read November 2, 2026
5. [Oxylabs Developers: Residential proxies session control](https://developers.oxylabs.io/products/proxies/residential-proxies/session-control), read November 2, 2026

## Questions

### Is a 504 from my proxy the website's fault?

Sometimes. A 504 means the gateway did not get a timely answer from upstream, and upstream is both the IP and the site behind it. If a fresh session reaches the same site, the old IP was the problem; if every session fails on one site, look at the site.

### How many times should I retry a 504?

Once on the same session at most, and then change the session id. In our test a dead session failed four times out of four, while fresh sessions on the same gateway mostly answered at once.

### Will changing the session id move my account?

Yes, to a new IP. With a country or city in the line, the new IP stays in that place, but it is a different address. For a signed-in account that is a small, visible change, which is why Mosaic never rotates a session you pinned yourself.

### Why does my proxy dashboard say it works when the browser gets a 504?

The dashboard or a provider check usually opens its own session, which is a different IP. Both answers can be true at once: the gateway is up and one session on it is dead.

## Related

[How to test a proxy before using it](https://mosaicbrowser.com/guides/test-a-proxy-before-using-it): How to test a proxy before using it: read its IP twice, prove it carries HTTPS, time it and check its DNS, all with curl, then test it again later.

[Rotating vs sticky proxies: which one an account needs](https://mosaicbrowser.com/guides/rotating-vs-sticky-proxies): Rotating vs sticky proxies: rotating changes the public IP per connection, sticky keeps one for a session you name. Logged-in accounts need sticky.

[Provider accounts: one proxy line, one IP per profile](https://mosaicbrowser.com/features/proxy-providers): Paste your proxy seller's line once and Mosaic makes a separate session for every profile, so each one browses from its own IP address.

[Check the proxy before launching a browser profile, every time](https://mosaicbrowser.com/features/proxy-check-before-launch): Mosaic checks the proxy before launching a browser profile: it must answer and carry HTTPS. If it does not, nothing opens and the error names the proxy.

[Set up a proxy for each browser profile automatically](https://mosaicbrowser.com/guides/set-up-a-proxy-for-each-browser-profile-automatically): How to set up a proxy for each browser profile automatically: save your seller's proxy line once so every profile gets its own session, or deal a list out.







[How long does a sticky session last?](https://mosaicbrowser.com/guides/how-long-does-a-sticky-session-last): How long does a sticky session last? Until the seller's timer, its idle limit or the device behind the IP ends it. Oxylabs defaults to 10 minutes.

## Run this guide on your own accounts

Every Mosaic profile is a fingerprint, a proxy IP and a cookie jar that agree with each other, kept on your computer. Free covers 3 profiles with no card, and Pro is $25 a month for any number of them.

Mosaic is a desktop app

Email yourself the link and open it on your computer.
