# Spoof IP for geoip plugin?

**URL:** <https://www.ruby-forum.com/t/spoof-ip-for-geoip-plugin/194893>\
**Category:** NGINX\
**Created:** [September 13, 2010, 10:34am UTC](https://www.ruby-forum.com/t/spoof-ip-for-geoip-plugin/194893 "2010-09-13T10:34:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![phillipoertel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4af34b/32.png) [@phillipoertel](https://www.ruby-forum.com/u/phillipoertel)\
**Post date:** [September 13, 2010, 10:34am UTC](https://www.ruby-forum.com/t/spoof-ip-for-geoip-plugin/194893/1 "2010-09-13T10:34:59Z")

</div>

Is there a way I can spoof my local IP when testing nginx’s geoip  
plugin? I’m running a VM which has a static IP on my local network which  
runs a development version of my app sitting behind nginx. I need to  
test that the right geoip headers are being passed to my app, but since  
I’m on a local network my ip isn’t set in the geoip.dat file.

---

<div class="post-metadata">

**Author:** ![phillipoertel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4af34b/32.png) [@phillipoertel](https://www.ruby-forum.com/u/phillipoertel)\
**Post date:** [September 13, 2010, 10:39am UTC](https://www.ruby-forum.com/t/spoof-ip-for-geoip-plugin/194893/2 "2010-09-13T10:39:05Z")

</div>

On Mon, Sep 13, 2010 at 09:34:26AM +0100, Phillip O. wrote:

> Is there a way I can spoof my local IP when testing nginx’s geoip  
> plugin? I’m running a VM which has a static IP on my local network which  
> runs a development version of my app sitting behind nginx. I need to  
> test that the right geoip headers are being passed to my app, but since  
> I’m on a local network my ip isn’t set in the geoip.dat file.

You shoul built nginx --with-http\_realip\_module, then add trusted client  
address in the confguration:

```
 set_real_ip_from 127.0.0.1;

```

and make requests with the header line:

X-Real-IP: 1.1.1.1

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**
