Outbound IP address on Load Balancers using PHP curl

I have this scenario… 2 droplets on the same region, connected to Load Balancer… How is that possible that when sending a request via PHP curl the API end point gets the droplet IP address? I want to split the amount of requests to the API I do per IP, so I don’t have issue of getting blocked… Is that possible?

Thanks in advance.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

DigitalOcean Employee
DigitalOcean Employee badge
April 15, 2019
Accepted Answer


If I understand correctly, you have an outbound job on your droplet which reaches out to an external API. You want to balance that task so that the requests do not all come from the same IP. If I am understanding this correctly, there may not be one correct answer from a generic perspective that can be guaranteed to fit your situation.

These are a couple of thoughts:

  1. If it were a cron job, for example, you could just do the cron job half as often from two servers.

  2. If you created multiple proxies for the API requests you could then put those behind an haproxy instance. So like let’s say the endpoint is, I could make:

- haproxy (
- - proxy1 ( ->
- - proxy2 ( ->

Then I could have haproxy balance all outbound traffic through the two servers under it. Setting this up isn’t something I could directly advise on as I’m unfamiliar with your specific situation, but in theory a stack like this could function quite well. You can use haproxy for just about anything that requires load balancing. You can see me doing it with SMTP here:


Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel