# Create a profile for a proxy's location: our bug

> Create a profile for a proxy's location and it should match the IP. Ours didn't for pasted proxies: one gateway gave New York, then Chicago. The fix.

Source: https://mosaicbrowser.com/blog/created-for-nowhere

## A profile created with a proxy was drawn for nowhere

Create a profile for a proxy's location and it should match the IP. Ours didn't for pasted proxies: one gateway gave New York, then Chicago. The fix.

![2 of 2: One European gateway, two American timezones](https://mosaicbrowser.com/covers/created-for-nowhere.webp)

When you create a profile for a proxy's location, the timezone, languages and geolocation should come from the address that proxy really comes out at. In Mosaic that was true for proxies saved and checked in the Proxies library, and false for the case almost everybody uses: a proxy pasted straight into the create call. Those profiles were drawn for no place at all.

## Two calls, two American cities

We found it by sending the shortest call our own API reference recommends, twice, a minute apart, with one pasted European gateway:

```
POST /profiles {"proxy":"user:pass@<eu gateway>:8669"}  ->  America/New_York, en-US
POST /profiles {"proxy":"user:pass@<eu gateway>:8669"}  ->  America/Chicago,  en-US
POST /profiles {}                     (no proxy)         ->  Europe/Vienna,    de-AT

```

America is not the evidence. The disagreement is. Two matches against one IP give one value twice, and two draws from a table give two values. New York and then Chicago from the same gateway meant nothing had looked at the gateway. A consistency scanner compares the IP's country with the browser's clock first, and every one of these profiles would have failed that comparison. The no-proxy profile, the case nobody automates, was the only one that came out right (that one has its own story in [a profile in Austria claimed New York](https://mosaicbrowser.com/blog/austria-claimed-new-york)).

## Every part was right on its own

Nothing in the code was obviously broken. The function that turns a proxy into a location refused to resolve an unchecked proxy, and its comment explained why: a blocking lookup during creation was not wanted, and falling back to the computer's own address would describe the one address the proxy exists to hide. The function that reads a pasted line set `lastCheck: null`, because a line nobody has contacted has not been measured. Both comments were correct.

Put together, they said something nobody had written down: a proxy you keep is matched, and a proxy you paste is not. Pasting is how the API is used. Batch creation, scripts and the MCP tools all hand over a line, often a fresh rotating session, and almost none of them save it to the library first. Two correct local decisions had made a wrong product.

Mosaic is a desktop app

Email yourself the link and open it on your computer.

[How it works: Matched to the proxy’s IP](https://mosaicbrowser.com/features/exit-matching)

## The fix: create the profile for the proxy's location, measured first

Creation now goes through one async function that REST, MCP and the window all call. It measures the IP before the identity is generated, through the same proxy connection a launch uses, and hands the result to the generator. The proxy also arrives with a real check attached, so it shows as live in the interface instead of untested for ever.

Three rules shaped it:

1. **Never fail the create.** A gateway that does not answer leaves you with the profiles you asked for, not with nothing.
2. **Never fail silently.** Every create on every surface returns `exitMatch`: `{ matched, source, countryCode, timezone, ip, reason }`. Before this field, a batch of forty drawn for nowhere looked byte for byte like a batch drawn for its IP.
3. **One measurement per IP.** The lookup is cached for five minutes on the exact IP, credentials included, because two sessions on one gateway are two IPs. A result from a rotating endpoint is never cached: its country belongs to whichever IP answered that second.

## What we measured after

We pointed a local proxy at this computer's own connection, so the right answer was known in advance, and ran each case:

| Case | Result |
| --- | --- |
| IP matching on, 5 creates | the computer's own zone, 5 times |
| IP matching off, 3 creates | New York, Zurich, Berlin |
| A dead gateway | created, `matched: false`, reason quotes `ECONNREFUSED` |
| `count: 4` | one lookup, four profiles, one zone |
| `countryCode: "DE"` passed | not measured, `matched: false`, reason names the field |

The second row is the control. One proxy, three unrelated timezones: that is what every pasted proxy produced before the fix.

The check that holds it, `check:create-exit`, has 63 assertions and replaces the proxy check with a stub that counts its calls. The count matters most, because 500 lookups for a batch of 500 look correct from outside and are unusable. We put five faults back one at a time, from skipping the lookup to failing the create, and each one fired its own line.

## The editor had the same bug

The profile editor matched the locale only after somebody pressed Check. Attach a proxy, press Create, and you got the same draw from the table, under a hint promising the opposite. The editor now measures an attached proxy itself, once per distinct IP, whether it is a saved row or a pasted line. We drove the running window through New profile, attached an unchecked proxy and pressed Continue without touching anything else. The Proxy tab showed the public IP, its city and its timezone, and the draft's locale had already moved to match.

![Creating a profile in Mosaic: a checked proxy, and the hardware and locale drawn to match its IP](https://mosaicbrowser.com/shots/profile-editor.png)
*The editor measures the proxy and draws the locale for it*

## A clamp that hid an empty answer

Merging three create paths into one showed drift between them. REST validated `count`; the other two clamped it with `Math.max(1, Math.min(Number(count), 500))`. `Number("abc")` is `NaN`, the loop never ran, and MCP answered 200 with an empty list. Now `0`, `501`, `2.5`, `"abc"` and `-1` are refused by name on every surface.

How the timezone, language and geolocation follow the IP after creation, on every launch, is on [IP matching](https://mosaicbrowser.com/features/exit-matching). If a profile you already have disagrees with its IP, [browser timezone does not match IP](https://mosaicbrowser.com/guides/browser-timezone-does-not-match-ip) has the fixes. And if you buy from a seller with a proxy line, [proxy providers](https://mosaicbrowser.com/features/proxy-providers) shows how each profile gets its own session, so each one is measured and drawn for its own IP.

## Questions

### How do I create a profile that matches my proxy's location?

Attach the proxy when you create the profile. Mosaic checks where the proxy's IP is before it draws anything, then takes the timezone, languages and geolocation from that IP. You do not pass a country yourself.

### What happens if the proxy is down when I create a profile?

The profile is still created, so a batch is never lost to one dead gateway. The response says exitMatch matched false and quotes the reason, so you know that profile was not drawn for its IP.

### Does creating 500 profiles behind one proxy make 500 lookups?

No. The measurement is cached for five minutes on the exact IP, credentials included, so a batch behind one proxy costs one lookup. A result from a rotating endpoint is never cached, because its country belongs to one connection.

### Can I still choose the country myself?

Yes. A countryCode or timezone you pass in fingerprintOptions wins over the measurement, and the response says the profile was not matched to the proxy's IP because fingerprintOptions pinned it.

## Related

[Match browser timezone to proxy IPs, automatically](https://mosaicbrowser.com/features/exit-matching): No need to match browser timezone to proxy by hand: Mosaic sets each profile's timezone, language and location from the measured IP, before every launch.

[A profile in Austria claimed New York](https://mosaicbrowser.com/blog/austria-claimed-new-york): Browser location does not match IP: a no-proxy profile made in Austria claimed New York. One failed lookup was never retried, and a table filled the gap.

[Browser timezone does not match IP: what it means and the fix](https://mosaicbrowser.com/guides/browser-timezone-does-not-match-ip): Browser timezone does not match IP? Your browser reads the computer's clock, and a proxy or VPN moves only the address. Match the zone to the IP.

[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.

[How to check a proxy before you use it](https://mosaicbrowser.com/guides/how-to-check-a-proxy-before-you-use-it): Check that a proxy answers and connects, where its IP really is, whether the address is residential or blocklisted, and that the browser stays behind it.







[Match the identity to the address it browses from](https://mosaicbrowser.com/blog/matching-identity-to-address): Match a profile's timezone, language and location to its proxy's measured IP. Mosaic draws them for it, re-checks at launch, and guards used languages.

## Mosaic, on your own computer

The browser this blog is about: its own Chromium, fingerprints from real machines and a proxy IP per profile. 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.
