We have just moved to Stackpath and now our payments are failing. I can see the requests hitting the server:

[08/Aug/2019:09:27:41 +0000] "POST/worldpay/processing/response...

I have enabled the debug logs and can see the error message below:

Worldpay response error: Domain can't be validated as WorldPay-Domain.
| improve this question | | | | |

I think this will be because magento is failing to determine the "remote address"

// validate request ip coming from WorldPay/RBS subnet
        $helper = Mage::helper('core/http');
        if (method_exists($helper, 'getRemoteAddr')) {
            $remoteAddr = $helper->getRemoteAddr();
        } else {
            $request = $this->getRequest()->getServer();
            $remoteAddr = $request['REMOTE_ADDR'];
        if (!preg_match('/\.worldpay\.com$/', gethostbyaddr($remoteAddr))) {
            Mage::throwException('Domain can\'t be validated as WorldPay-Domain.');

This can be fixed by adding the stackpath "REAL ID" header into your config.
If you edit the file app/etc/local.xml and add:


Inside config->global Then refresh your cache "remote address" should now be correct.

You can test this by placing the file test-remote-address.php

define('MAGENTO_ROOT', getcwd());
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
require MAGENTO_ROOT . '/app/bootstrap.php';
require_once $mageFilename;

echo 'address: '.Mage::helper('core/http')->getRemoteAddr();

In your web root then requesting it with your browser. You will notice that after updating app/etc/local.xml it will be correct.
Be sure to remove this file once you are happy

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.