SoftwareGuy / NodeListServer

Node List Server is a multi-purpose server list system. NodeJS powered and supports Docker.
Other
92 stars 33 forks source link

Starting new server in AWS EC2 uses private IP instead of public IP #11

Closed DanielTizon closed 3 years ago

DanielTizon commented 3 years ago

Hi guys, First of all, thanks for the great job you are doing with the server list. I'm having a little problem, when running headless server in a AWS EC2 ubuntu instance, it is automatically added to server list, but it is added with the "Private IP" of the AWS EC2 isntance, instead of "Public IP".

SoftwareGuy commented 3 years ago

Is the server list also inside the virtual LAN of Amazon, or is it hosted elsewhere - ie. Linode and Vultr?

What I think is happening is Amazon is internally translating your public IP into a local request if the IP points to a instance inside the virtual LAN. NodeLS then sees the local IP of that box instead of public IP.

What you could do is find a provider of an API that allows you to query the IP address. I can't remember the name of the provider I used to use but they'd reply with both IPv4/IPv6 address data. Without the code in front of me I don't think NodeLS allows you to send the IP address explicitly, but it shouldn't be too difficult to allow that override instead of trusting the remote address.

DanielTizon commented 3 years ago

I have done two changes:

And now it looks be working correctly,

Thanks!