Skip to Content
GuidesUse a proxy

Use a proxy

Lightpanda supports using your own proxy, both locally and on Lightpanda Cloud. On Lightpanda Cloud, you can also use a shared proxy we provide instead.

Use a proxy locally

To use a proxy, start Lightpanda from the command line with --http-proxy followed by an HTTP or HTTPS proxy address. All outgoing requests go through the proxy, regardless of the protocol your client uses to connect to Lightpanda.

The examples below use serve, but fetch, mcp, and agent accept these options too.

lightpanda serve --http-proxy http://127.0.0.1:3000

Authenticate with basic auth

Add basic auth  credentials to the proxy address with the username:password@ format.

lightpanda serve --http-proxy 'http://me:my-password@127.0.0.1:3000'

Authenticate with a bearer token

--proxy-bearer-token authenticates with bearer auth . It adds a Proxy-Authorization header to all outgoing requests.

lightpanda serve --http-proxy 'http://127.0.0.1:3000' --proxy-bearer-token 'MY-TOKEN'

Authenticate from your script

You can also pass the proxy credentials from your Puppeteer or Playwright script instead of the command line.

Selenium can’t do this, because Lightpanda does not support proxy authentication over WebDriver BiDi. Put the credentials in the --http-proxy URL instead.

With Puppeteer, you have to configure the proxy address when starting Lightpanda.

lightpanda serve --http-proxy 'http://127.0.0.1:3000'

Then you can call page.authenticate function to inject your authentication from your script.

const page = await context.newPage(); // Set credentials for HTTP Basic Auth await page.authenticate({ username: 'my_username', password: 'my_password', });

You can find the full example in our demo repository .