I have a Craft application in an intranet behind a proxy. I'm struggling to find a way of configuring the application so it can access the internet via the proxy, in particular for the auto updating and license check.
I tried using PHP's stream_context_set_default() but cannot get it to work in the admin section. Here's what i did so far:
I created a connect.php file in my public folder just to check if my script works. It does as i can get the headers for any site.
$PROXY_HOST = "url.to.my.proxy";
$PROXY_PORT = "8080";
$PROXY_USER = "username";
$PROXY_PASS = "password";
$auth = base64_encode("$PROXY_USER:$PROXY_PASS");
stream_context_set_default(
array(
'http' => array(
'proxy' => "tcp://$PROXY_HOST:$PROXY_PORT",
'request_fulluri' => true,
'header' => "Proxy-Authorization: Basic $auth"
)
)
);
$url = "https://elliott.buildwithcraft.com/actions/elliott/app/ping";
print_r( get_headers($url) );
From there, i'm stuck. I have no idea what to do next to try and inject that into the auto updating part of Craft. I know it's bad to mess with the core, and don't want to, but i have no idea where to go from here.
Anyone been in a similar situation ?
Am i missing something obvious where all of this wouldn't be needed ? (hope so)
Following @BradBell answer i searched for Guzzle information and found this in the documentation for Guzzle 3.x:
Requests options can be specified when creating a request or in the request.options parameter of a client. These options can control various aspects of a request including: headers to send, query string data, where the response should be downloaded, proxies, auth, etc.
$request = $client->get($url, $headers, array('proxy' => 'http://proxy.com'));
Maybe this can be put to some use in the current Craft install?
If so, some guidance will be greatly appreciated.