Support wildcard expressions in WP_PROXY_BYPASS_HOSTS (and WP_ACCESSIBLE_HOSTS)
|Reported by:||sit||Owned by:|
When configuring a proxy inside a firewall, a common configuration is to have all external requests go through a proxy and allow internal requests to proceed directly. In such cases, it would be useful to allow wildcard expressions to apply to exclusions so that all internal requests could be specified simply. However, today, if I want to send everything but *.wordpress.com requests through to a proxy, there is no way to express that using WP_PROXY_BYPASS_HOSTS. Instead, each host needs to be explicitly listed, which is not feasible.
I suppose, ideally, Wordpress would support proxy auto config (.pac files http://en.wikipedia.org/wiki/Proxy_auto-config) but just simple wildcard support would be a very useful improvement.
Adding wild-cards could be accomplished by updating the uses of in_array in wp-includes/class-http.php (say, in WP_HTTP_Proxy's send_through_proxy at line 1634 in trunk today) to use fnmatch (as described here http://www.mattgregg.com/php-wildcard-match-in-an-array.html or in some of the comments under http://php.net/manual/en/function.in-array.php for example). It looks like it should be a pretty straight-forward change.