VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: cjcatalano on February 09, 2016, 18:24:13 PM

Title: Error after CDN implementation
Post by: cjcatalano on February 09, 2016, 18:24:13 PM
Hi All,
Yesterday we added the Cloudflare CDN to our site to offload some of the image and css traffic. Today we started getting emails from our Virtuemart system notifying us of an error.
The message is:  An error with your payment method paypal on your store bSmart Market. The details are logged in the file paypal.1.log.php
And in that file the error is:  2016-02-09 14:56:37 ERROR checkPaypalIps: Error with REMOTE IP ADDRESS = 162.158.255.47.
                        The remote address of the script posting to this notify script does not match a valid PayPal IP address

            These are the valid IP Addresses: 23.78.209.37,173.0.81.1,173.0.81.33,216.113.188.202,216.113.188.203     and this list goes on and on.

Does anything special have to be done within Virtuemart once a CDN is utilized for the joomla site? It seems that the remote ip in the error message is related to CloudFlare.

Thanks,
CJ
Title: Re: Error after CDN implementation
Post by: VMTemplates.net on February 09, 2016, 19:38:41 PM
Hi,

if I good remember CF provides an option to turn off selected elements/pages from delivery service - not sure about free plans.
However I suggest you to contact CF support.
Title: Re: Error after CDN implementation
Post by: cjcatalano on February 09, 2016, 20:54:44 PM
I contacted Cloudflare and they suggested that I should contact Paypal.  They also said that they could provide a whitelist of IP addresses for them.  Not sure what they mean.  But is that error being generated by Virtuemart or is it from Paypal?
Title: Re: Error after CDN implementation
Post by: jenkinhill on February 09, 2016, 21:25:37 PM
The error originates message from PayPal.
Title: Re: Error after CDN implementation
Post by: cjcatalano on February 09, 2016, 23:50:02 PM
Actually, I disagree. The message originates from a VM script which is checking the ip address of the return IPN against a list of known Paypal IPs. Apparently this has been a problem in the past as I see some other threads related to the issue. Unfortunately most of those other threads seem to indicate that the problem was resolved in subsequent VM updates. But I'm running the most recent and the problem still exists.

Quote from: jenkinhill on February 09, 2016, 21:25:37 PM
The error originates message from PayPal.
Title: Re: Error after CDN implementation
Post by: Milbo on February 09, 2016, 23:55:58 PM
Please check the vm config setting about reverse proxies!
Title: Re: Error after CDN implementation
Post by: jenkinhill on February 10, 2016, 00:05:58 AM
Quote from: cjcatalano on February 09, 2016, 23:50:02 PM
Actually, I disagree.

Yes I submitted the message before finishing it properly due to a sudden emergency (fox in with next doors' hens!). Paypal returns the IP which is checked and found to be incorrect, presumably one used by Cloudflare.  Enter the proxy IPs under VM Configuration/Shop/Advanced Settings and see if that fixes the problem.
Title: Re: Error after CDN implementation
Post by: cjcatalano on February 10, 2016, 01:14:04 AM
Yikes! I hope the hens are ok. I see the configuration section you're referring to. So I just put the ip address (Cloudflare IP) that was in the error message in there? Because the field refers to a reverse proxy header.
Thank You.
Title: Re: Error after CDN implementation
Post by: jenkinhill on February 10, 2016, 11:24:53 AM
Try it. I never use any CDN or proxy with VirtueMart so have not seen this issue.
Title: Re: Error after CDN implementation
Post by: cjcatalano on February 10, 2016, 15:31:32 PM
Milbo,
Is there any documentation on this? I cannot find any in the Documentation section.
Thank You.

Quote from: Milbo on February 09, 2016, 23:55:58 PM
Please check the vm config setting about reverse proxies!
Title: Re: Error after CDN implementation
Post by: macigatto on February 13, 2017, 21:45:24 PM
hello,

I got the same error and I run on cloud flare, can you please explain what to do to fix it?

thank you.
Title: Re: Error after CDN implementation
Post by: jenkinhill on February 13, 2017, 23:49:56 PM
This may help with your Cloudflare configuration:  http://www.readybytes.net/blog/item/tips-to-use-cloudflare-with-ecommerce-sites.html
Title: Re: Error after CDN implementation
Post by: Milbo on February 14, 2017, 08:40:36 AM
Quote from: cjcatalano on February 10, 2016, 15:31:32 PM
Milbo,
Is there any documentation on this? I cannot find any in the Documentation section.
Thank You.

Quote from: Milbo on February 09, 2016, 23:55:58 PM
Please check the vm config setting about reverse proxies!

You need to set here the right proxy header in case you use a reverse proxy. Googling "proxy header cloudflare" I found https://support.cloudflare.com/hc/en-us/articles/200170986-How-does-CloudFlare-handle-HTTP-Request-headers- so using X-Forwarded-For could work. But I would concentrate first on the page rules of cloudflare.
Title: Re: Error after CDN implementation
Post by: atrus on February 16, 2017, 08:32:47 AM
Hello all,

Interesting topic, we also face the same Paypal problem in our website (https://www.quality-tuning.eu) where we have implemented Cloudflare (Business Plan - not only CDN).

@cjcatalano: Maybe in your case the solution is simple, 162.158.255.47 is indeed a Cloudflare IP so you can try the reverse proxy setting in VM3, smth like

X-Forwarded-For:162.158.255.47

as Milbo suggested and see if it works.

Now to the tricky one: have you installed mod_cloudflare (https://github.com/cloudflare/mod_cloudflare)? (We have installed this)

In our case, we get the following:

ERROR checkPaypalIps: Error with REMOTE IP ADDRESS = 93.174.126.18.

But 93.174.126.18 is the IP of our server, so i'm a bit stuck here, appreciate any advice.

Rgrds,
Chris
Title: Re: Error after CDN implementation
Post by: VMTemplates.net on February 16, 2017, 11:20:01 AM
Hi,

try this - using any code editor open /plugins/vmpayment/paypal/paypal/helpers/paypal.php
line 535
add IP to following line:
$paypal_iplist3 = array('216.113.188.202', '216.113.188.203', '216.113.188.204');

It should solve an issue with CF
Title: Re: Error after CDN implementation
Post by: atrus on February 17, 2017, 09:54:53 AM
The solution by VMTemplates seems to be working in our case, thanks!
Title: Re: Error after CDN implementation
Post by: VMTemplates.net on February 20, 2017, 11:18:24 AM
Hi,

great!!! Please note you may need to add another IPs each time you get another errors in logs

Thanks,
J.