Back to Blog

How to Set Up a Proxy: Step-by-Step Guide

March 25, 20268 min read

Setting up a proxy can seem intimidating if you have never done it before, but the process is straightforward once you understand the basics. This guide walks you through configuring proxies in the most popular tools and programming languages, from a simple curl command to full Python and Node.js implementations. We also cover advanced features like country targeting and sticky sessions.

What You Need Before Starting

  • Proxy host: proxy.globedata.io
  • Port: 8080 (HTTP/HTTPS)
  • Username: Your proxy username from the GlobeData dashboard
  • Password: Your proxy password from the GlobeData dashboard

If you do not have an account yet, create one here and purchase a bandwidth package to get your credentials.

Step 1: Basic HTTP Proxy with curl

The fastest way to test your proxy is with curl. This single command routes your request through the proxy and returns the IP address the target website sees.

curl
# Basic proxy request
curl -x "http://YOUR_USER:YOUR_PASS@proxy.globedata.io:8080" \
  https://httpbin.org/ip

# With country targeting (US)
curl -x "http://YOUR_USER-country-US:YOUR_PASS@proxy.globedata.io:8080" \
  https://httpbin.org/ip

# With sticky session (same IP for 5 minutes)
curl -x "http://YOUR_USER-session-test1-ttl-300:YOUR_PASS@proxy.globedata.io:8080" \
  https://httpbin.org/ip

If the response shows a different IP than your own, the proxy is working. The -x flag tells curl to use the specified proxy for the request.

Step 2: Python Setup with Requests

Python's requests library is the most popular choice for web scraping and API calls. Here is how to configure it with a proxy.

Python
import requests

# Define your proxy
proxy = {
    "http": "http://YOUR_USER:YOUR_PASS@proxy.globedata.io:8080",
    "https": "http://YOUR_USER:YOUR_PASS@proxy.globedata.io:8080"
}

# Make a request through the proxy
response = requests.get("https://httpbin.org/ip", proxies=proxy, timeout=30)
print(response.json())

# With country targeting
proxy_us = {
    "http": "http://YOUR_USER-country-US:YOUR_PASS@proxy.globedata.io:8080",
    "https": "http://YOUR_USER-country-US:YOUR_PASS@proxy.globedata.io:8080"
}

response = requests.get("https://httpbin.org/ip", proxies=proxy_us)
print(f"US IP: {response.json()['origin']}")

# Using a session for multiple requests with sticky IP
session = requests.Session()
session.proxies = {
    "http": "http://YOUR_USER-session-s1-ttl-600:YOUR_PASS@proxy.globedata.io:8080",
    "https": "http://YOUR_USER-session-s1-ttl-600:YOUR_PASS@proxy.globedata.io:8080"
}

# Both requests use the same IP
page1 = session.get("https://example.com/page/1")
page2 = session.get("https://example.com/page/2")

Step 3: Node.js Setup with Axios

For Node.js projects, you can use axios with the https-proxy-agent package, or use the built-in proxy support.

Node.js
const axios = require('axios');
const HttpsProxyAgent = require('https-proxy-agent');

const proxyUrl = 'http://YOUR_USER:YOUR_PASS@proxy.globedata.io:8080';
const agent = new HttpsProxyAgent(proxyUrl);

// Make a request through the proxy
const response = await axios.get('https://httpbin.org/ip', {
  httpsAgent: agent,
  timeout: 30000
});

console.log(response.data);

// With country targeting
const usAgent = new HttpsProxyAgent(
  'http://YOUR_USER-country-US:YOUR_PASS@proxy.globedata.io:8080'
);

const usResponse = await axios.get('https://httpbin.org/ip', {
  httpsAgent: usAgent
});

console.log('US IP:', usResponse.data.origin);

Step 4: SOCKS5 Proxy Setup

SOCKS5 proxies operate at a lower network level than HTTP proxies, supporting any protocol including TCP and UDP. This makes them useful for non-HTTP applications. GlobeData supports SOCKS5 on the same endpoint.

Python (SOCKS5)
# Install: pip install requests[socks]
import requests

proxy = {
    "http": "socks5://YOUR_USER:YOUR_PASS@proxy.globedata.io:8080",
    "https": "socks5://YOUR_USER:YOUR_PASS@proxy.globedata.io:8080"
}

response = requests.get("https://httpbin.org/ip", proxies=proxy)
print(response.json())

Step 5: Country Targeting

GlobeData supports geo-targeting by appending a country code to your username. Use standard ISO 3166-1 alpha-2 country codes. Here are the most commonly used codes:

US - United States
GB - United Kingdom
DE - Germany
FR - France
JP - Japan
BR - Brazil
AU - Australia
CA - Canada

Format: YOUR_USER-country-US

Step 6: Sticky Sessions

Sticky sessions let you maintain the same IP address across multiple requests for a defined duration. This is essential for multi-step workflows like logging into a website, navigating through pages, or completing a checkout process.

Append -session-IDENTIFIER-ttl-SECONDS to your username:

  • USER-session-checkout1-ttl-300 - Same IP for 5 minutes
  • USER-session-browse99-ttl-900 - Same IP for 15 minutes
  • USER-country-US-session-us1-ttl-600 - US IP, sticky for 10 minutes

The session identifier can be any string. Use unique identifiers for parallel tasks so each task gets its own sticky IP.

Troubleshooting Common Issues

407 Proxy Authentication Required

Your username or password is incorrect. Double-check your credentials in the GlobeData dashboard. Make sure there are no extra spaces or special characters being URL-encoded incorrectly.

Connection Timeout

Ensure you are connecting to proxy.globedata.io:8080. If you are behind a corporate firewall, port 8080 may be blocked. Try increasing your timeout to 30 seconds for the initial connection.

403 Forbidden from Target Site

The proxy is working but the target website is blocking the request. Try adding realistic User-Agent and Accept headers. If using datacenter proxies, switch to residential. Enable country targeting to match the site's expected geography.

SSL Certificate Errors

When using HTTPS through an HTTP proxy, the proxy creates a CONNECT tunnel. If you see SSL errors, make sure you are using http:// (not https://) in your proxy URL itself. The proxy URL uses HTTP; the target URL can be HTTPS.

Related Articles

Set Up Your Proxy in Minutes

Create a free account, grab your credentials, and start routing traffic through 90M+ residential IPs. No complex configuration required.

Create Free Account