Hi
Hi,
Now that firewall rules have become custom rules, we can finally specify a custom HTML block response per rule, which is fantastic.
However, a few things could be improved.
There’s no way to quickly customize just the block reason because custom HTML replaces the whole block page. Ideally, there’d be a way to use an existing CF template and just customize the block reason.
To work around that, I pulled HTML from CF’s existing block page and made a few tweaks, including specifying a custom reason. Upon submitting the HTML, I saw that the response limit is a measly 2048 bytes, which isn’t even enough to serve CF’s own block page. I had to cut it down severely. Ideally, the limit would be a bit higher - at least 4096 bytes.
How do we use dynamic fields in responses? I tried using ::RAY_ID:: and ::CLIENT_IP:: per https://developers.cloudflare.com/support/more-dashboard-apps/cloudflare-custom-pages/configuring-custom-pages-error-and-challenge/, but they just got output verbatim instead of their dynamic values.
4 Replies
https://developers.cloudflare.com/waf/reference/migration-guides/firewall-rules-to-custom-rules/ explains the transition.
Firewall rules are becoming custom rules · Cloudflare Web Applicati...
Cloudflare started converting existing firewall rules into WAF custom rules. With custom rules you get the same level of protection and a few …
Also started this thread in the meantime https://community.cloudflare.com/t/new-custom-waf-rules-custom-html-response-dynamic-fields-2048-char-limit-and-more/544909
Cloudflare Community
New custom WAF rules custom HTML response: dynamic fields, 2048 cha...
Hi, Now that firewall rules have become custom rules, we can finally specify a custom HTML block response per rule, which is fantastic. However, a few things could be improved. There’s no way to quickly customize just the block reason because custom HTML replaces the whole block page. Ideally, there’d be a way to use an existing CF template...
I do not believe you can use those custom replacements or anything close in the custom rule responses
If that's what you want, you would have to use Custom Pages directly, you can specify them at the zone/website or account level
The problem is there is no way to customize those per rule
I hope this capability is going to be improved in the future to be a bit more flexible