Havoc][ Posted August 29, 2011 Share Posted August 29, 2011 Hello all, for Security Reason our PrestaShop is behind a Proxy Server for outgoing(!) Traffic. Its not a reverse Proxy. How could i configure Prestashop to use a Webproxy for getting Prestashop updates, connecting to Paypal/etc. Services an so on? No direct Outgoing Traffic is allowed :-(. Thanks & Regards, Jens Link to comment Share on other sites More sharing options...
phrasespot Posted September 1, 2011 Share Posted September 1, 2011 [' timestamp=1314646044' post='619689]our PrestaShop is behind a Proxy Server for outgoing(!) Traffic. Its not a reverse Proxy. How could i configure Prestashop to use a Webproxy for getting Prestashop updates, connecting to Paypal/etc. Services an so on? No direct Outgoing Traffic is allowed :-(. This is not something you do on application layer so it has nothing to do with Prestashop installation. The machine that the Prestashop is installed on must be configured to use the proxy. Then the proxy will deal with sending traffic to the relevant location wherever that may be; updates or PayPal etc. and return replies back to that machine, hence to Prestashop. Specifics of the configuration is machine and proxy dependent. Link to comment Share on other sites More sharing options...
Havoc][ Posted September 1, 2011 Author Share Posted September 1, 2011 This is not something you do on application layer so it has nothing to do with Prestashop installation. The machine that the Prestashop is installed on must be configured to use the proxy. Then the proxy will deal with sending traffic to the relevant location wherever that may be; updates or PayPal etc. and return replies back to that machine, hence to Prestashop. Specifics of the configuration is machine and proxy dependent. I have just set http_proxy Environment Variabel for www-data user. But it doesnt work - so maybe there need to be another Setting within Prestashop, wich ignores Proxyservers Settings... I have Debian Linux 6 with a Standard Apache 2.2.9 - how do i configure a Proxy for PrestaShop? Many Thanks! Jens Link to comment Share on other sites More sharing options...
Havoc][ Posted September 1, 2011 Author Share Posted September 1, 2011 Maybe, i found the Codesnipet which is responsible for that (/classes/Tools.php): 1210 public static function file_get_contents($url, $useIncludePath = false, $streamContext = NULL) 1211 { 1212 if (in_array(ini_get('allow_url_fopen'), array('On', 'on', '1'))) 1213 return file_get_contents($url, $useIncludePath, $streamContext); 1214 else if (function_exists('curl_init')) 1215 { 1216 $curl = curl_init(); 1217 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); 1218 curl_setopt($curl, CURLOPT_URL, $url); 1219 //curl_setopt($curl, CURLOPT_PROXY, 'URLTOMYPROXY'); 1220 //curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, 1); 1221 $content = curl_exec($curl); 1222 curl_close($curl); 1223 return $content; 1224 } 1225 else 1226 return false; 1227 } Maybe someone could help me to understand, what this exactly does. Because: if i turn "allow_url_fopen" in php.ini off, nothing is execute - it seems that the curl thing wouldn be called. The function returns false (i think). Even if function_exists('curl_init') returns true - and the rest should be executed. I added the two commented setopt lines, but it doesnt work. Whats wrong? Thanks! Jens Link to comment Share on other sites More sharing options...
Havoc][ Posted September 8, 2011 Author Share Posted September 8, 2011 *bump* Is there no one who can help me? Against the position from phrasespot Proxy Connections are *not* set on Operating System Layer. Maybe under Windows there are such possibilities but not under Linux. And not under any Security Environment im working on. If there is any connection to - lets say - Port 10000, its not possible to handle that trough a transparent Proxy (like i tried to do so with iptables under linux for prestashop at the moment). Proxy Connections are set - of course - on Application Layer. If this Shopsystem will become Enterprise someday, there is a need to set a proxy server. Its highly recommended for security reasons. Because, if someone could break into your Webshop, its possible to download anything from anywhere (like a trojan/backdoor...) if the server has direct access to http/https/ftp/ssh etc. So, please, could someone help me to get/find a workarround? Are there any missing Information you need to help me? Or do i need to create a Bugreport? Thanks! Jens 1 Link to comment Share on other sites More sharing options...
Tornevall Posted January 24, 2022 Share Posted January 24, 2022 (edited) This is a very old thread as it seems, but as many others unsolved. Did you find out how to solve this? I had this problem myself during an installation of PrestaShop, where the installer obviously requires network access to reach language packas - and it is correct that Tools can be changed for this purpose. A little catch though, is the fact that at least the installer needs both curl and streams to handle internet access through proxies, so it has to be done in two steps. Based on a http-squid proxy (for my own case), this solved the installation for me (and hopefully it might also help with other things in the platform). First step is to look up private static function file_get_contents_curl( and add curl_setopt($curl, CURLOPT_PROXY, 'http://proxy.address:3128/'); curl_setopt($curl, CURLOPT_PROXYTYPE, 0); ... just after the rest of the setopt-rows. Second step is to look up public static function file_get_contents( and update the same for the stream-client. The rows below is based on an installation of PrestaShop 1.7.7.5, where the parts proxy and request_fulluri is added for both http and https-proxies: $stream_context = @stream_context_create( [ 'http' => ['timeout' => 3, 'proxy' => 'tcp://proxy.address:3128','request_fulluri' => true], 'https' => ['proxy' => 'tcp://proxy.address:3128', 'request_fulluri' => true], 'ssl' => ['cafile' => CaBundle::getBundledCaBundlePath()], ] ); If the scripts does not accept at FQDN-host, you can simply use the ip-address. Since this was about an installation for me, after this I could click "retry" and proceed as usuall with the installation. Edited January 24, 2022 by Tornevall (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now