import axios from "axios";
// ==================== Proxy Configuration (Replace with your actual credentials) ====================
const username = "YOUR_USERNAME"; // Replace with the username from YumiProxy dashboard
const password = "YOUR_PASSWORD"; // Replace with the password from YumiProxy dashboard
// Older axios (v0.x) supports the proxy option directly in request config
// Note: axios v1.x+ has removed this option; please use the first approach (HttpsProxyAgent)
axios
.get("https://ipinfo.io/json", {
proxy: {
protocol: "http", // Proxy protocol (fixed to http because CONNECT tunnel uses http)
host: "proxy.yumiproxy.com", // Replace with the proxy server host from the dashboard
port: 9091, // Replace with the port from the dashboard
auth: {
username: username, // Proxy authentication username
password: password, // Proxy authentication password
},
},
timeout: 30000, // Timeout in milliseconds; adjust as needed
})
.then((response) => {
console.log(response.data); // Output response JSON
})
.catch((error) => {
console.error("Request failed:", error.message);
});