-
Notifications
You must be signed in to change notification settings - Fork 862
Description
Hi!
I encountered a case where this feature would be useful, and I wondered if it might be of interest to you.
Current behavior
Currently, the loader can be configured to use a proxy via HTTP_LOADER_PROXY_* settings.
However, this setup is static: it's either always using the proxy or never using it, regardless of the target URL.
Proposed feature
It would be useful to support http_proxy, https_proxy, no_proxy and all_proxy environment variables, allowing Thumbor to dynamically decide whether to use or bypass a proxy based on the target URL.
Notes
I wouldn't call this "standard," but it's a common convention for environment-based proxy configuration.
Moreover, it's supported in many HTTP clients.
For instance, curl or requests support it.
Tornado does not support it.
urllib.request has some support to detect wether to use or bypass the proxy based on these environment variables. See https://github.com/python/cpython/blob/c1bfd4cb9c86a35c03ca330589ff0eda4d5ce77c/Lib/urllib/request.py#L2136
Would this be something you'd consider for inclusion?
I'd be happy to help with a PR if there's interest.
PS: Thanks for your work on Thumbor!