Use Proxy For Dynamic IP Address

October 17, 2016 329 views
DigitalOcean Ubuntu 16.04

Is it possible to use a proxy service, so that for each HTTP request from the server to outside, I'll get different IP address

1 Answer

This should be possible but there are a few moving pieces to think about.

You'll want to set up a Dynamic DNS service. There are free public options or you could set up something yourself. The way this works is that the computer with a dynamic IP address runs an agent that reports into the Dynamic DNS service when it's IP changes and a DNS record is automatically updated. These records are set up with a very low TTL (time to live) so that the changes happen as seamlessly as possible.

Once you have this in place, you can set up nginx using the proxy_pass directive so that it will pass requests to that new dynamic DNS name rather than an IP address. This way your static IP will host your proxy but the content served will come from your computer with the dynamic IP.

This tutorial will show you how to configure Nginx as both a web server and as a reverse proxy for Apache – all on one Droplet. Depending on the web application, code changes might be required to keep Apache reverse-proxy-aware, especially when SSL sites are configured. To ensure this, we will install an Apache module named **mod_rpaf** which rewrites certain environment variables so it appears that Apache is directly handling requests from web clients.
Have another answer? Share your knowledge.