I current have a golang program that I have a supervisor config file like such
[program:yout_go]
command = /bin/sh -c 'http_proxy=user:password@123.123.123.123 /home/www/program -env prod'
directory = /home/www/
enviroment=PATH='/home/www/env/bin:/usr/bin'
user = user
autorestart = true
stderr_logfile = /var/log/program/err.log
stdout_logfile = /var/log/program/out.log
Currently I am running it via 1 proxy, but I want to have it run through more proxies.
Is there any way I can do this? Such as having the http_proxy pull from a list of proxies or do I have to make the goprogram run through it?
The Go http package uses the HTTP_PROXY
, HTTPS_PROXY
and NO_PROXY
environment variables like other programs, and looks for a single url.
If you want to rotate through multiple proxies, you need to provide a custom Proxy
function to your http.Transport
, rather than rely on the default http.ProxyFromEnvironment
.