Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


cpanel dedicated ip outbound request
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

cpanel dedicated ip outbound request

SaahibSaahib Host Rep, Veteran
edited September 2016 in Help

Hi,
I have few user on cPanel with dedicated IP, they want to fetch some data from third party using file_get_content() in php. However, whenever they are making request from their domain to third party, its always showing coming form main IP of the server but not from their assigned IP.

So is it possible to assign their dedicated IP to outbound requests ?

Let me rephrase my question:
Say, I have apache virtual host with dedicated IP, if that virtual host (ie. script from that virtual host) makes an outbound request to some third party, what IP address will be sent , will it be this dedicated IP of virtual host or it will be main server IP ?

Comments

  • racksxracksx Member
    edited September 2016

    If you are using a dedicated IP, it should go out with dedicated ip, maybe their script has been specified which ip to use for outbound requests.

  • SaahibSaahib Host Rep, Veteran

    @racksx said:
    If you are using a dedicated IP, it should go out with dedicated ip, maybe their script has been specified which ip to use for outbound requests.

    This is what I expected but request is going out from main IP of the server only. Is it that even a domain has dedicated IP, but outbound request are always from main server IP ? If so, how can change to domain IP ?

  • @Saahib said:

    @racksx said:
    If you are using a dedicated IP, it should go out with dedicated ip, maybe their script has been specified which ip to use for outbound requests.

    This is what I expected but request is going out from main IP of the server only. Is it that even a domain has dedicated IP, but outbound request are always from main server IP ? If so, how can change to domain IP ?

    are you using apache? nginx?

    try open a ticket to cpanel, sure they will help you out with this question.

  • SaahibSaahib Host Rep, Veteran

    Ok, let me rephrase my question:

    Say, I have apache virtual host with dedicated IP, if that virtual host (ie. script from that virtual host) makes an outbound request to some third party, what IP address will be sent , will it be this dedicated IP of virtual host or it will be main server IP ?

  • Seems like you've got both a Vhosts entry for the main IP and also the dedicated IP. I don't think theres a way for PHP to differentiate, however you may be able to ask the provider to remove you from the main IP vhost and just have you on as the dedicatd, this should stop that.

    Unless however, all traffic falls out of one IP anyway, which negates the objective of having the dedicated ip...

  • SaahibSaahib Host Rep, Veteran

    @eastonch said:
    Seems like you've got both a Vhosts entry for the main IP and also the dedicated IP. I don't think theres a way for PHP to differentiate, however you may be able to ask the provider to remove you from the main IP vhost and just have you on as the dedicatd, this should stop that.

    Unless however, all traffic falls out of one IP anyway, which negates the objective of having the dedicated ip...

    Thanks for the reply, however, its just an standard cpanel setup with few IPs with dedicated domains, hence its me only who is suppose to make changes , can't really ask anyone.

    I have rephrased my question, what do you have to say .. any advice..

    @Saahib said:
    Ok, let me rephrase my question:

    Say, I have apache virtual host with dedicated IP, if that virtual host (ie. script from that virtual host) makes an outbound request to some third party, what IP address will be sent , will it be this dedicated IP of virtual host or it will be main server IP ?

  • Whats your apache config for vhost for this one

  • Usually outbound requests are sent by the server primary IP. Use curl setopt for such cases.

    http://www.php.net/curl_setopt

  • BrianHarrisonBrianHarrison Member, Patron Provider
    edited September 2016

    @racksx said:

    @Saahib said:

    @racksx said:
    If you are using a dedicated IP, it should go out with dedicated ip, maybe their script has been specified which ip to use for outbound requests.

    This is what I expected but request is going out from main IP of the server only. Is it that even a domain has dedicated IP, but outbound request are always from main server IP ? If so, how can change to domain IP ?

    are you using apache? nginx?

    try open a ticket to cpanel, sure they will help you out with this question.

    This isn't a cPanel issue nor is it a bug at all -- it's just how file_get_contents() works.

    File_get_contents() is a crude tool for retrieving content from a remote URL -- use Curl instead. With Curl you can specify the source IP address that it should use while making the request (CURLOPT_INTERFACE option).

  • SaahibSaahib Host Rep, Veteran

    @sdglhm said:
    Usually outbound requests are sent by the server primary IP. Use curl setopt for such cases.

    http://www.php.net/curl_setopt

    Yap, looks like the case as I figured it out from further research because outgoing request has nothing to do with web server and its where virtual IP is configured to accept connection for a domain.

    @BrianHarrison said:

    @racksx said:

    @Saahib said:

    @racksx said:
    If you are using a dedicated IP, it should go out with dedicated ip, maybe their script has been specified which ip to use for outbound requests.

    This is what I expected but request is going out from main IP of the server only. Is it that even a domain has dedicated IP, but outbound request are always from main server IP ? If so, how can change to domain IP ?

    are you using apache? nginx?

    try open a ticket to cpanel, sure they will help you out with this question.

    This isn't a cPanel issue nor is it a bug at all -- it's just how file_get_contents() works.

    File_get_contents() is a crude tool for retrieving content from a remote URL -- use Curl instead. With Curl you can specify the source IP address that it should use while making the request (CURLOPT_INTERFACE option).

    I guess curl is just apt for it. INTERFACE option worked well.

Sign In or Register to comment.