Corporate Proxy Handling in function.php (HTTP_PROXY AND NO_PROXY)

Hi,

(First post so please be patient :wink: )

I am using TTRSS with Docker in a corporate proxy environment. which means that you’ll need to set HTTP_PROXY and NO_PROXY curl opts to make meaningful usage of a http client.

So I needed to adapt the function.php to be able to support the NO_PROXY curl opts appropriately, like

                    if (defined('_CURL_HTTP_PROXY')) {
                            curl_setopt($ch, CURLOPT_PROXY, _CURL_HTTP_PROXY);
                    }

                    if (getenv('HTTP_PROXY') !== false) {
                            curl_setopt($ch, CURLOPT_PROXY, getenv('HTTP_PROXY'));
                    }

                    if (getenv('NO_PROXY') !== false) {
                            curl_setopt($ch, CURLOPT_NO_PROXY, getenv('NO_PROXY'));
                    }

As said I am in a Docker environment, therefore I choose to use the environment variables rather than going for the configuration properties - I am not sure how much this interferes with your standard approaches about configurability.

Anyways, I’ll see the need for handling the NO_PROXY setting.

Does this make sense to you?

Thanks and cheers
Tobias

proxies are not officially supported and never going to be, i’m also not going to add esoteric features for your bespoke docker configuration, if that’s what you’re asking for.

It’s not about Docker - just omit that, I’ve just mentioned it to make clear why my code snippet uses environment variables rather than config properties.

There is support for proxies in the curl client creation, but it does not deal with the very common NO_PROXY directive.
The thing is: There is support for proxies (and it’s quite easy to handle this, since it is part of the curl client anyways), but not to the extend that is required (or a standard pattern) if you do need to use proxies in more complex environments.