# How to determine if a IP addresssis "local"?

**URL:** <https://www.ruby-forum.com/t/how-to-determine-if-a-ip-addresssis-local/67930>\
**Category:** Ruby\
**Created:** [September 8, 2006, 12:26am UTC](https://www.ruby-forum.com/t/how-to-determine-if-a-ip-addresssis-local/67930 "2006-09-08T00:26:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vtphysguy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/77aa72/32.png) [@vtphysguy](https://www.ruby-forum.com/u/vtphysguy)\
**Post date:** [September 8, 2006, 12:26am UTC](https://www.ruby-forum.com/t/how-to-determine-if-a-ip-addresssis-local/67930/1 "2006-09-08T00:26:20Z")

</div>

Does the ruby standard library or core include a way to determine if a  
network address is “local”? Specifically, my workplace uses a proxy  
server for all web traffic. I have several scripts that use open-uri.  
When the http\_proxy environment variable is set, open-uri will proxy  
all requests to the defined proxy server. I’d like to write patch it  
to ignore that behavior for “local” addresses, and I’m hoping the ruby  
library already gives me the ability to determine that. Anyone know?

If not - how would I make that determination? Would it just be  
requests to the “fake” IP addresses (i.e. 172.16.\*, etc)?

Thanks!

Justin

---

<div class="post-metadata">

**Author:** ![vtphysguy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/77aa72/32.png) [@vtphysguy](https://www.ruby-forum.com/u/vtphysguy)\
**Post date:** [September 9, 2006, 2:06pm UTC](https://www.ruby-forum.com/t/how-to-determine-if-a-ip-addresssis-local/67930/2 "2006-09-09T14:06:19Z")

</div>

Justin B. wrote:

> Does the ruby standard library or core include a way to determine if a  
> network address is “local”? Specifically, my workplace uses a proxy  
> server for all web traffic. I have several scripts that use open-uri.  
> When the http\_proxy environment variable is set, open-uri will proxy  
> all requests to the defined proxy server. I’d like to write patch it  
> to ignore that behavior for “local” addresses, and I’m hoping the ruby  
> library already gives me the ability to determine that. Anyone know?

Hmm. Proxy autoconfiguration file support in open-uri? I presume there’s  
a pac file on your intranet someplace that mentions what addresses are  
local - this wouldn’t be a bad new feature.

David V.
