Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[loader http] Support proxy and no_proxy env variables #1768

@brambaud

Description

@brambaud

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!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions