Skip to content

Cloudflare

C0nw0nk edited this page Feb 1, 2020 · 8 revisions

Cloudflare

The following is only needed if you are using Cloudflare as a proxy service, If you use it as DNS only you do not need to do any of this.

Modify the following line : https://github.com/C0nw0nk/Nginx-Lua-Anti-DDoS/blob/master/lua/anti_ddos_challenge.lua#L65

To this :

local remote_addr = "auto"

Optional to avoid Issues with Cloudflare page rules

Cache Everything Page rule

So Cloudflare allows you to Cache pages on their CDN the header status in requests will say

CF-Cache-Status : HIT

If you use page rules to Cache pages of your site you need to modify this line.

https://github.com/C0nw0nk/Nginx-Lua-Anti-DDoS/blob/master/lua/anti_ddos_challenge.lua#L85

To this :

local javascript_REQUEST_TYPE = 2

Because Cloudflare caches GET requests it will cache the Anti-DDoS page output instead of what you intend to be Cached so to fix it we make it a POST request since Cloudflare does not Cache those.

Clone this wiki locally