Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Use WeProxy with Node.js

WeProxy — Node.js proxy example

Website Node Integrations

Minimal, runnable example: route HTTPS traffic through the WeProxy HTTP proxy gateway from Node.js using https-proxy-agent, then print your exit IP.


Why this pattern

Node’s built-in https client accepts an agent. HttpsProxyAgent turns your WeProxy URL into that agent so every request leaves through gw.weproxy.com.tr:8989.

Works for:

  • Scrapers and bots in Node
  • Backend jobs that must egress via residential / DC packages
  • Quick connectivity checks in CI (with secrets in env, never in git)

Requirements

  • Node.js 18+
  • Credentials from my.we1.town
  • Network access to the WeProxy gateway

Install

npm install
cp .env.example .env

Set real values (do not commit .env):

WEPROXY_HOST=gw.weproxy.com.tr
WEPROXY_PORT=8989
WEPROXY_USER=your-panel-user
WEPROXY_PASS=your-panel-pass

Or one shot:

WEPROXY_URL=http://USER:PASSWORD@gw.weproxy.com.tr:8989

Run

npm run check-ip

PowerShell:

$env:WEPROXY_USER="your-user"
$env:WEPROXY_PASS="your-pass"
npm run check-ip

Expected output: Exit IP: x.x.x.x

Core snippet

import https from 'node:https'
import { HttpsProxyAgent } from 'https-proxy-agent'

const agent = new HttpsProxyAgent('http://USER:PASSWORD@gw.weproxy.com.tr:8989')

https.get('https://api.ipify.org', { agent }, (res) => {
  let body = ''
  res.on('data', (chunk) => (body += chunk))
  res.on('end', () => console.log(body))
})

Full script with env parsing and errors: src/check-ip.js.

Residential vs datacenter in Node

The code path is identical. Switch products by using the credentials for the package you bought:

SOCKS5 needs a SOCKS-capable agent and a package that enables SOCKS — this repo stays on HTTP proxy mode.

Troubleshooting

Symptom What to check
407 / auth errors Username/password from panel; URL-encoding special characters
Timeouts Firewall, wrong host/port, package suspended
Wrong country Panel targeting / package — not this sample’s job
Works in cURL, fails in Node Confirm HttpsProxyAgent wraps the same URL as cURL -x

Manual cURL baseline:

curl -x http://USER:PASSWORD@gw.weproxy.com.tr:8989 https://api.ipify.org

Project layout

nodejs-proxy/
├── assets/banner.png
├── src/check-ip.js
├── .env.example
├── package.json
└── README.md

Related WeProxy repos

License

MIT — see LICENSE.

About

Node.js + WeProxy HTTP proxy example using https-proxy-agent (exit IP check)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages