How to disable CloudFlare IPv6 access

If you want to disable IPv6, you are probably running project with some old code that is not able to process IPv6 REMOTE_ADDR in PHP. I assume you do not use CF API at all, so fastest option will be to use global API key to disable IPv6 and then generate new global API key.
Get your CF account global API key from CF user panel: https://dash.cloudflare.com/profile/api-tokens

Execute in terminal with curl installed (ex. Linux) or Postman:

curl -X PATCH "https://api.cloudflare.com/client/v4/zones/YOUR-ZONE-ID/settings/ipv6" \
-H "X-Auth-Email: YOUR@EMAIL.COM " \
-H "X-Auth-Key: YOUR-GLOBAL-API-KEY" \
-H "Content-Type: application/json" \
--data '{"value":"off"}'

with your ZONE ID, CF E-MAIL and GLOBAL API KEY.

If you execute this curl line on your Linux server without space as start of line, your CF global API key will be stored in Linux command line history. Generate new global API key in CF panel, it will disable old API key.

Leave a Reply

Your email address will not be published. Required fields are marked *