metadatacloudflarewhatsapp

How do I use cloudflare on my website and still have the meta data on whatsappp appear?


I developed a website where I am using Cloudflare 'Under Attack Mode'. When I make a post on Facebook or LinkedIn, etc., the metadata appear just fine. However, they do not appear on WhatsApp. How do I fix this?

Please note that they come up on WhatsApp when the "Under Attack Mode" is turned off.


Solution

  • If Cloudflare is flagging WhatsApp or requests, you can allow the WhatsApp user-agent to bypass challenges by creating a configuration rule. Go to Rules > Overview, then select Create Rule > Configuration Rule. In the new rule, choose "Custom filter expression" under "When incoming requests match...". Use the expression editor to set the condition to starts_with(http.request.headers["user-agent"][0], "WhatsApp/"). Under the "Then" section, set the action to Browser Integrity Check or Under Attack mode, depending on what you need. This should resolve the issue.