Submitting PHP issues via a proxy server

Hi guys, recently we started to migrate all our exception handling over to Sentry.

However we’ve got a cluster of servers which have restricted internet connection, so the only way they can contact the internet is via a proxy.

E.g. when we use curl on the project we have a set up similar to

        $proxy = '147.128.9.224:8080';

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_PROXY, $proxy);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

        try {
            $file_contents = curl_exec($ch);
        }
        catch(Exception $e){
            $file_contents = false;
        }

        curl_close($ch);

So we just pass in the proxy to the curl request - how can we apply this same logic to the Sentry/Raven handler within laravel and within the standard php package?

Thanks

This was also discussed in a issue on getsentry/sentry-laravel but for future reference.

When using the PHP SDK of Sentry you can pass the http_proxy key (and as value your proxy url) with the DSN and other options when instantiating Raven_Client.

In case of the Laravel integration you can add a config array to your sentry.php config file like this which will then be passed to the Raven_Client via the service provider:

'config' => [
    'http_proxy' => $proxy,
],

The http_proxy value is directly passed to CURLOPT_PROXY so any value you would give there should also be passed to http_proxy.

Hello,

I have the same issue with Symfony. And it seems that the option “sentry: http_proxy” is not allowed because i have a message from symfony that this option is not knowned when i modifie the parmater.yml and try to clear cache to update the configuration.

Can you help me on this subject please?

Regards