Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow getting IP address from "X-Real-Ip", "X-Forwarded-For" headers #45

Merged
merged 7 commits into from
Feb 27, 2020

Conversation

joshdvir
Copy link
Contributor

Hi,

I've added some code to allow getting the IP address automatically from "X-Real-Ip", "X-Forwarded-For" headers.

So if the application is behind a Load Balancer there is no need to send the IP address.

Solves #42 and #33

@drpdishant
Copy link

This is an Important feature. Considering the scenario where a system uses multiple active interfaces, but only one interface has the externally accessible IP.
This feature will not require user to know which IP is the external one. And the API will automatically update the IP through which the request has been received.

I tested and It works very well.

vagrant@ubuntu-bionic:~$ hostname -I
10.0.2.15 192.168.0.11
vagrant@ubuntu-bionic:~$ curl "http://192.168.0.10:8080/update?secret=changeme&domain=node-1"
{"Success":true,"Message":"Updated A record for node-1 to IP address 192.168.0.11","Domain":"node-1","Domains":["node-1"],"Address":"192.168.0.11","AddrType":"A"}
vagrant@ubuntu-bionic:~$ dig +short -t A node-1.example.org @192.168.0.10
192.168.0.11

@dprandzioch requesting you to merge it to make it availabe through your repo.

@dstapp
Copy link
Owner

dstapp commented Feb 23, 2020

Hey, thanks for adding this. I'll review it shortly and then merge it!

@dstapp
Copy link
Owner

dstapp commented Feb 23, 2020

@joshdvir Looks good, but could you please add unit tests for your changes as well? Just to make sure that nothing breaks in the future :-)

I'd do it but I'm really short in time right now.

@joshdvir
Copy link
Contributor Author

@dprandzioch implemented tests, enjoy.

@dstapp
Copy link
Owner

dstapp commented Feb 27, 2020

Perfect, thanks. Also works for me (y). I'll merge it and publish it to :latest with the next release. Until then, feel free to grab the :develop image :-)

@dstapp dstapp merged commit 4c4d2af into dstapp:develop Feb 27, 2020
@dstapp dstapp mentioned this pull request Feb 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants