# Only allow Cloudflare IPs for Discourse server

**URL:** <https://meta.discourse.org/t/only-allow-cloudflare-ips-for-discourse-server/70489>\
**Category:** Self-hosting\
**Created:** [21 سبتمبر 2017، 6:01ص UTC](https://meta.discourse.org/t/only-allow-cloudflare-ips-for-discourse-server/70489 "2017-09-21T06:01:47Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Brock\_Busby](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/brock_busby/32/118746_2.png) [@Brock\_Busby](https://meta.discourse.org/u/Brock_Busby)\
**Post date:** [21 سبتمبر 2017، 6:01ص UTC](https://meta.discourse.org/t/only-allow-cloudflare-ips-for-discourse-server/70489/1 "2017-09-21T06:01:47Z")

</div>

All of our servers, site and Discourse community (discussions.ftw.in) sit behind Cloudflare.

Can we set at the Discourse server level to only allow Cloudflare IPs and deny all other IP traffic?

We’ve been under a DDoS layer 7 attack and learned our main site IP was exposed.  
To fix this, we updated our .htaccess on our main site server to only allow traffic from Cloudflare IPs and deny all other traffic. This does not let our origin server IP get exposed.

We are not exactly sure how to do the same above for our Discourse server at the server level. In my searches, I’ve seen cloudflare.template.yml mentioned and that it’s set to make sure we are seeing our user IPs, but I’m not sure.

Thanks in advance!

---

_[View the full topic](https://meta.discourse.org/t/only-allow-cloudflare-ips-for-discourse-server/70489)._
