# Feature idea: retrieve set\_real\_ip\_from (HttpRealipModule) from a text file online

**URL:** <https://www.ruby-forum.com/t/feature-idea-retrieve-set-real-ip-from-httprealipmodule-from-a-text-file-online/225332>\
**Category:** NGINX\
**Created:** [December 30, 2012, 2:39am UTC](https://www.ruby-forum.com/t/feature-idea-retrieve-set-real-ip-from-httprealipmodule-from-a-text-file-online/225332 "2012-12-30T02:39:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [December 30, 2012, 2:39am UTC](https://www.ruby-forum.com/t/feature-idea-retrieve-set-real-ip-from-httprealipmodule-from-a-text-file-online/225332/1 "2012-12-30T02:39:11Z")

</div>

What about adding the possibility to retrieve a list of set\_real\_ip\_from  
from a text file online? I’m thinking about CloudFlare, that provides  
this  
2 files (plain text): [https://www.cloudflare.com/ips-v4](https://www.cloudflare.com/ips-v4) and  
[https://www.cloudflare.com/ips-v6](https://www.cloudflare.com/ips-v6)

It could be useful also for other big projects where nginx is used as  
proxy.

---

<div class="post-metadata">

**Author:** ![lorenzo\_r](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/aca169/32.png) [@lorenzo\_r](https://www.ruby-forum.com/u/lorenzo_r)\
**Post date:** [December 30, 2012, 12:31pm UTC](https://www.ruby-forum.com/t/feature-idea-retrieve-set-real-ip-from-httprealipmodule-from-a-text-file-online/225332/2 "2012-12-30T12:31:24Z")

</div>

On Sun, Dec 30, 2012 at 02:38:09AM +0100, Lorenzo R. wrote:

Hi there,

> What about adding the possibility to retrieve a list of set\_real\_ip\_from  
> from a text file online?

With the “include” directive and “nginx -s reload”, have you not enough  
support in nginx to do this already?

An external script to periodically fetch the url contents, stick  
"set\_real\_ip\_from " at the start and “;” at the end (or do whatever  
other  
manipulation is needed to make correct nginx.conf syntax) and save to  
a local file, and then get nginx to use the updated config?

I’m not sure what extra benefit there would be to building something  
like this in to nginx.

Perhaps I’m missing something,

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![lorenzo\_r](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/aca169/32.png) [@lorenzo\_r](https://www.ruby-forum.com/u/lorenzo_r)\
**Post date:** [December 30, 2012, 2:34pm UTC](https://www.ruby-forum.com/t/feature-idea-retrieve-set-real-ip-from-httprealipmodule-from-a-text-file-online/225332/3 "2012-12-30T14:34:04Z")

</div>

The idea is to have it built-in, without having to arrange a script that  
fetches an external file and appends each line to set\_real\_ip\_from and  
adds  
a ;  
It would be a hundreds bytes add and IMO would help many. It’s just an  
idea  
anayway.

2012/12/30 Lorenzo R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![lorenzo\_r](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/aca169/32.png) [@lorenzo\_r](https://www.ruby-forum.com/u/lorenzo_r)\
**Post date:** [December 30, 2012, 3:34pm UTC](https://www.ruby-forum.com/t/feature-idea-retrieve-set-real-ip-from-httprealipmodule-from-a-text-file-online/225332/4 "2012-12-30T15:34:14Z")

</div>

On Sun, Dec 30, 2012 at 8:33 PM, Lorenzo R.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> The idea is to have it built-in, without having to arrange a script that  
> fetches an external file and appends each line to set\_real\_ip\_from and adds  
> a ;  
> It would be a hundreds bytes add and IMO would help many. It’s just an idea  
> anayway.

do you really need this one liner built into nginx?

curl [http://what-ever.com/list](http://what-ever.com/list) | sed ‘s/^/set\_real\_ip\_from /;s/$/;/’ \

---

<div class="post-metadata">

**Author:** ![lorenzo\_r](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/aca169/32.png) [@lorenzo\_r](https://www.ruby-forum.com/u/lorenzo_r)\
**Post date:** [December 30, 2012, 9:18pm UTC](https://www.ruby-forum.com/t/feature-idea-retrieve-set-real-ip-from-httprealipmodule-from-a-text-file-online/225332/5 "2012-12-30T21:18:50Z")

</div>

Uhm, you’re right.

Anyway if can be useful for others in the future here’s the script to  
fetch  
2 files and mix 'em together preserving the set\_real\_ip\_from formatting:  
{  
curl -s [https://www.cloudflare.com/ips-v4](https://www.cloudflare.com/ips-v4)  
printf ‘\n’  
curl -s [https://www.cloudflare.com/ips-v6](https://www.cloudflare.com/ips-v6)  
} | sed -r ‘s/^(.+)$/set\_real\_ip\_from \1;/g’ \> some-list.conf && nginx  
-s  
reload

2012/12/30 Lorenzo R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
