views:

351

answers:

2

I'm using CFHTTP to post data to my payment gateway (Protx).

Protx requires that I whitelist the IP that will send this request.

I am hosted on a shared server running Windows 2008.

This morning, my hosting company assigned a new IP to this server for a customer who required an SSL certificate. Since then, my CFHTTP post appears to be coming from this new IP (which was not on the Protx whitelist).

My hosting company, being the worst imaginable, don't know why this is and aren't willing to look into it further.

Does anyone have any idea how I can specify which referring IP address CFHTTP will use to post data?

+2  A: 

what you essentially want to do is spoof your IP address your passing to Protx.

this can be done using the cfhttparam tag.

<cfhttpparam type="header" name="host" value="">

ex.

<cfhttpparam type="header" name="host" value="10.1.1.1">

refer to the Nabble post for more also look at the livedocs for cfhttpparam

rip747
This didn't work, Protx still identifies the new IP address.I should perhaps be more clear, the hosting company didn't change the IP, the old IP is still assigned to the server - they don't know why cfhttp is now using the new IP to post from.
Gary
+2  A: 

I do not believe this is possible directly. CF will rely on the underlying OS to handle the TCP/IP request, so the OS will determine what IP will be used for the request. It may be possible to spoof the IP by specifying host headers, but I'm not sure how to do it or how effective that would be.

First, I'd suggest you get Protx to whitelist the new IP.

Second, if you have a proxy server available, this might provide a solution. CFHTTP can use a proxy, and you could have the proxy's IP whitelisted. This way, no matter the IP that CFHTTP is on, the Protx server will see the proxy's address.

Ben Doom
I've already whitelisted this new IP, but if the hosting company introduces another IP (as they are very likely to do) the problem will occurr again. I need to know why cfhttp is choosing this new IP over the old ones...
Gary