Reputation: 2757
I've created an page in ROR, which will be loaded from some website in an IFRAME. And the page will display to some of the whitelisted servers only.
I want to get public IP of server (which is requesting from IFRAME) so that I can return the content to some of the whitelisted IPs.
I've tried this SO answer but it giver server's PRIVATE IP not PUBLIC IP.
Also checked the request
variable but it have client IP(IP of the computer accessing the site) not server's public IP.
Using Ruby v2.1.5.
and Rails v3.2
Upvotes: 0
Views: 533
Reputation: 1115
You could use a hacky way to do so. You could explicitly send server IP along with the response. So when you loaded the page, you could cache the IP and then send it along with the request of the iframe page.
For example, you could generate the request url of the iframe as
//www.yourdomain.com/your/path?request_ip=<IP that you cached earlier>
But its just a hacky way and it will only work if you can control the request URL of the IFrame.
Upvotes: 0
Reputation: 8646
You can not do that. It is not the server which is requesting the content of the IFrame but the client.
Upvotes: 1