imageproxy use proxy to request image?
thanh858036 opened this issue · comments
thanh858036 commented
Hi Will,
First of all thanks for this wonderful tool and this is very handy, I hope if you don't mind asking can we explicitly tell imageproxy to use proxy list to request image? so that a remote site will block ip server if server request many to site
Ivan commented
Yes, you can setup proxy from Environment.
Currently, by default it uses DefaultTransport and it uses Proxy: ProxyFromEnvironment,
.
You can setup it by using following tip:
func FromEnvironment() *Config {
return &Config{
HTTPProxy: getEnvAny("HTTP_PROXY", "http_proxy"),
HTTPSProxy: getEnvAny("HTTPS_PROXY", "https_proxy"),
NoProxy: getEnvAny("NO_PROXY", "no_proxy"),
CGI: os.Getenv("REQUEST_METHOD") != "",
}
}
Will Norris commented
Thanks @Fieldistor, I wasn't even aware of that myself... that the DefaultTransport would accept those environment variables :)