Is there a way to implement static ip on Netlify Functions?

In order to make request to Line Pay, I am searching a way to whitelist ip with Netlify Functions. However, the ip seems to change once an hour. Heroku also uses dynamic ip, but can be solved by using Fixie to route request through static ip. I would like to know if there is a way to implement it with Netlify Functions.

1 Like

Hi @poweiharn , welcome to the community!

It’s not possible to get a static IP for serverless functions with any host that I’m aware of. that’s a bit antithetical to how you’re supposed to think of them, since they you aren’t supposed to worry about where they are hosted, or anything to do with the server they are running on. I’m not familiar with Line Pay, but I do not that lots of other payment processes will allow you to make payments from dynamic IP’s. Sorry I don’t have a great solution for you, but if your only option is to get a static IP then maybe a cheap droplet from digital ocean would be a better fit for the backend.

2 Likes

This is not possible with Netlify functions.

You would need to setup your own VPC with a static IP and your own backing lambda function. See https://medium.com/@matthewleak/aws-lambda-functions-with-a-static-ip-89a3ada0b471 for more info.

I’m not familiar with Fixie but perhaps this is possible to use Fixie to point to your function endpoint :thinking:

1 Like

Two ways to approach this that I have found, that latter of which I’ve tried:

  1. Tunnel your requests over a HTTP proxy with a static IP address (this is similar to @DavidWells linked medium article he suggested above)
  2. Use QuotaGuard, a service similar to Fixie, that provides this configuration of a static IP for you. I modified the Node.js code in this example to remotely connect to a MySQL database via a Static IP provided by QuotaGaurd.

Hope this helps someone!

1 Like

If the above QuotaGuard example code is broken, it moved to this link