Trying to use static proxy group

I'm trying to use a static proxy group to send traffic through our specific proxy server with a stable IP address below the piece of code involved
const httpsAgent = new HttpsProxyAgent({
host: 'proxy.apify.com',
port: 8000,
auth: "<username>:<password>"
});
const axiosWithProxy = axios.create({httpsAgent});
const response = await axiosWithProxy.get(endpoint);
const httpsAgent = new HttpsProxyAgent({
host: 'proxy.apify.com',
port: 8000,
auth: "<username>:<password>"
});
const axiosWithProxy = axios.create({httpsAgent});
const response = await axiosWithProxy.get(endpoint);
but when launch the execution of the bit, last line of code above return an error that say: "Request failed with status code 407 AxiosError: Request failed with status code 407 ..." error details are shown in the attached screenshot. Anyone can help me please?
No description
3 Replies
stormy-gold
stormy-gold•12mo ago
Hello @sergioska, can you try to initialize the HttpsProxyAgent using only the proxy URL?
new HttpsProxyAgent('http://<username>:<password>@proxy.apify.com:8000');
new HttpsProxyAgent('http://<username>:<password>@proxy.apify.com:8000');
sensitive-blue
sensitive-blueOP•12mo ago
Hi @vojtechmaslan thanks for the suggestion, I'll try that and I'll say something wow @vojtechmaslan it seems that works :perfecto: I can't believe it 😄 thank you so much
stormy-gold
stormy-gold•12mo ago
I'm glad it helped! 😃

Did you find this page helpful?