Got Proxy Configuration
← Back to JavaScript / TypeScript Libraries
Got is a human-friendly, powerful HTTP client for Node.js with strong TypeScript support. Use Got with ProxyMesh for web scraping and API clients. The javascript-proxy-headers package provides createProxyGot(), which returns a Got-style client that sends custom proxy headers and exposes X-ProxyMesh-IP in response headers.
Installation
npm install got javascript-proxy-headers
Or from JSR: npx jsr add @proxymesh/javascript-proxy-headers then npm install got.
Basic Proxy Configuration
Use createProxyGot() to get a client configured with your ProxyMesh proxy:
import { createProxyGot } from 'javascript-proxy-headers/got';
const client = createProxyGot({
proxy: 'http://username:password@proxyhost:31280'
});
const response = await client('https://api.ipify.org?format=json');
console.log(response.body);
console.log(response.headers['x-proxymesh-ip']);
Custom Proxy Headers
Pass proxyHeaders when creating the client to send custom headers to the proxy:
import { createProxyGot } from 'javascript-proxy-headers/got';
const client = createProxyGot({
proxy: 'http://username:password@proxyhost:31280',
proxyHeaders: { 'X-ProxyMesh-Country': 'US' }
});
const response = await client('https://httpbin.org/ip');
console.log(response.headers['x-proxymesh-ip']);
ProxyMesh Headers Reference
Send these headers to control proxy behavior:
X-ProxyMesh-Country- Route through a specific country (e.g., "US"). Only works with world proxy or open proxyX-ProxyMesh-IP- Request a specific outgoing IP addressX-ProxyMesh-Not-IP- Exclude specific IPs from rotation
The proxy returns X-ProxyMesh-IP in the response with the IP address used.
Resources
- Got Documentation
- javascript-proxy-headers (Got)
- javascript-proxy-headers on npm
- @proxymesh/javascript-proxy-headers on JSR
- Example Code on GitHub
Related JavaScript / TypeScript Proxy Guides
Explore proxy configuration for other JavaScript / TypeScript HTTP libraries: