The Proxy.setLocation function enables users to dynamically change the location of their proxy to a desired destination within a specified radius. This feature is particularly useful for operations that require geographically specific data or testing of geo-targeted content.



Specifies the latitude of the desired proxy location.


Specifies the longitude of the desired proxy location.


Defines the maximum distance from the provided coordinates within which the proxy can be located.

Unit: Kilometers.

default: "true"

Defines the desired behavior in case no peers are available in the specified distance.

strict: true - our system will search for available peers only within the specific distance.

strict: false - if no peers are available in the specified distance we will automatically expand the distance and look for the nearest available peers.


The Proxy.setLocation command should be invoked before navigating to the site for which the proxy is intended. This ensures that the proxy location is set accurately according to the specified parameters before any data requests are made.

How to run examples

You need to get Scraping Browsers credentials in the control panel. Pass it in format USER:PASS as environment variable AUTH

export AUTH=brd-customer-hl_01234567-zone-scraping_browser:abcdefghijkl
You can also pass TARGET_URL environment variable to change default targeted website.

Code Examples

Change proxy location before scraping

Select your pefered tech-stack
#!/usr/bin/env node
const playwright = require('playwright');
const {
    TARGET_URL = '',
    LOCATION = 'amsterdam',
} = process.env;

const LOCATIONS = Object.freeze({
    amsterdam: { lat: 52.377956, lon: 4.897070 },
    london: { lat: 51.509865, lon: -0.118092 },
    new_york: { lat: 40.730610, lon: -73.935242 },
    paris: { lat: 48.864716, lon: 2.349014 },

async function scrape(url = TARGET_URL, location = LOCATION) {
    if (AUTH == 'USER:PASS') {
        throw new Error(`Provide Scraping Browsers credentials in AUTH`
            + ` environment variable or update the script.`);
    if (!LOCATIONS[location]) {
        throw new Error(`Unknown location`);
    const { lat, lon } = LOCATIONS[location];
    console.log(`Connecting to Browser...`);
    const endpointURL = `wss://${AUTH}`;
    const browser = await playwright.chromium.connectOverCDP(endpointURL);
    try {
        console.log(`Connected! Changing proxy location`
            + ` to ${location} (${lat}, ${lon})...`);
        const page = await browser.newPage();
        const client = await page.context().newCDPSession(page);
        await client.send('Proxy.setLocation', {
            lat, lon,
            distance: 50 /* kilometers */,
            strict: true,
        console.log(`Navigating to ${url}...`);
        await page.goto(url, { timeout: 2 * 60 * 1000 });
        console.log(`Navigated! Scraping data...`);
        const data = await page.$eval('body', el => el.innerText);
        console.log(`Scraped! Data:`, JSON.parse(data));
    } finally {
        await browser.close();

if (require.main == module) {
    scrape().catch(error => {
        console.error(error.stack || error.message || error);