Title: Web server behind  a reverse proxy
Last modified: September 1, 2016

---

# Web server behind a reverse proxy

 *  Resolved [CacheGuard](https://wordpress.org/support/users/cacheguard/)
 * (@cacheguard)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/web-server-behind-a-reverse-proxy/)
 * Hi
 * I use a reverse proxy in front of my Web server so whenever I receive a message
   the IP of the sender is set to the IP of my local reverse proxy.
 * My reverse proxy add the X-Forwarded-For header to the HTTP requests so is there
   any possibility to get the real IP of the sender instead of the IP of my reverse
   proxy?
 * Best Regards,
 * [https://wordpress.org/plugins/pirate-forms/](https://wordpress.org/plugins/pirate-forms/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [rodicaelena](https://wordpress.org/support/users/rodicaelena/)
 * (@rodicaelena)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/web-server-behind-a-reverse-proxy/#post-7475083)
 * Hi [@cacheguard](https://wordpress.org/support/users/cacheguard/),
 * Unfortunately, I am not able to test this, but if you want you can try to edit
   the file pirate-forms.php and let us know if it’s working.
 * You need to change this line:
 * `$contact_ip = filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP );`
 * to:
 *     ```
       $contact_ip = $_SERVER['REMOTE_ADDR'];
       if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) {
           $contact_ip = array_pop(explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']));
       }
       ```
   
 * If it’s helping, we can add this in a future update.
 * Best regards,
    Rodica
 *  Thread Starter [CacheGuard](https://wordpress.org/support/users/cacheguard/)
 * (@cacheguard)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/web-server-behind-a-reverse-proxy/#post-7475086)
 * Dear rodicaelena
 * It works perfectly! That was exactly what I was looking for. Thank you so much.
 * Best Regards
    CacheGuard
 *  [rodicaelena](https://wordpress.org/support/users/rodicaelena/)
 * (@rodicaelena)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/web-server-behind-a-reverse-proxy/#post-7475087)
 * Hi CacheGuard,
 * I’m really happy to hear this. We’ll add this in the next update, so you don’t
   have to change the code everytime you want to update.
    If you are happy with 
   us and our product, you can always leave us a review here [https://wordpress.org/support/view/plugin-reviews/pirate-forms#postform](https://wordpress.org/support/view/plugin-reviews/pirate-forms#postform).
   It would help us a lot 🙂
 * Thank you,
    Rodica
 *  Thread Starter [CacheGuard](https://wordpress.org/support/users/cacheguard/)
 * (@cacheguard)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/web-server-behind-a-reverse-proxy/#post-7475088)
 * I did it. Thanks again.
 *  [Hardeep Asrani](https://wordpress.org/support/users/hardeepasrani/)
 * (@hardeepasrani)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/web-server-behind-a-reverse-proxy/#post-7475105)
 * Thanks a lot for that. Have a great day. 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Web server behind a reverse proxy’ is closed to new replies.

 * ![](https://ps.w.org/pirate-forms/assets/icon-128x128.png?rev=1635118)
 * [Contact Form & SMTP Plugin for WordPress by PirateForms](https://wordpress.org/plugins/pirate-forms/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pirate-forms/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pirate-forms/)
 * [Active Topics](https://wordpress.org/support/plugin/pirate-forms/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pirate-forms/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pirate-forms/reviews/)

## Tags

 * [reverse proxy](https://wordpress.org/support/topic-tag/reverse-proxy/)

 * 5 replies
 * 3 participants
 * Last reply from: [Hardeep Asrani](https://wordpress.org/support/users/hardeepasrani/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/web-server-behind-a-reverse-proxy/#post-7475105)
 * Status: resolved