I have an Ubuntu 20.4 LTS that running Squid as a proxy server.
I have a scenario that I'm forwarding traffic from another server to the Linux server using plink with the following command:
plink.exe -L 0.0.0.0:PORT:localhost:SQUID_PORT [email protected] -pw "pass" -N -v
Output:
Local port 0.0.0.0:PORT forwarding to localhost:SQUID_PORT
To test it, I'm using the following python code (After running the command above):
import requests
headers = {"user-agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36"}
proxies = {
'http': 'http://Proxy_IP:PORT',
'https': 'http://Proxy_IP:PORT',
}
proxies2 = {
'http': 'http://localhost:1230',
'https': 'http://localhost:1230',
}
res = requests.get(url='https://api.ipify.org/?format=json', proxies=proxies)
print(res.text)
I'm getting the following error:
Forwarded connection refused by the server: Connect failed [Connection timed out]
This issue isn't happening when I'm using the proxy IP instead of localhost (proxies2 in the python code)
What can be the cause of this issue? It's important to say that the same scenario is working on a different proxy server, so I'm sure that it's related to the Linux server configurations.