Apify and Crawlee Official Forum

Updated 3 months ago

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
Plain Text
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?
Attachment
Screenshot_2024-06-06_at_16.03.41.png
v
s
6 comments
Hello , can you try to initialize the HttpsProxyAgent using only the proxy URL?

Plain Text
new HttpsProxyAgent('http://<username>:<password>@proxy.apify.com:8000');
Hi thanks for the suggestion, I'll try that and I'll say something
wow it seems that works
I can't believe it πŸ˜„
thank you so much
I'm glad it helped! πŸ˜ƒ
Add a reply
Sign up and join the conversation on Discord