Common ASV Scan Errors When Behind Cloudflare
Cloudflare sits between the ASV's scanner and your server. That is great for security, but it often makes a PCI scan fail, time out, or report on Cloudflare instead of you. Here are the seven errors we see most, and how to fix them.
The short answer
For most sites, the best fix is to allow-list your ASV's scanning IPs in Cloudflare, so Cloudflare keeps protecting your site during the scan. If the scan still fails, or the findings describe Cloudflare instead of your server, set your DNS record to DNS only (grey cloud) for the scan as a backup.
The 7 most common errors
- The scan only sees Cloudflare, not your origin server. If Cloudflare is proxying traffic ("orange-clouded") and your origin IP isn't reachable, the ASV's scanner reports on Cloudflare's edge instead of your actual server. That can hide real problems on your origin, and it doesn't meet the intent of a PCI ASV scan, which must test the system that actually handles the traffic.
Fix: an allow-list won't change this one. Use the backup fix and turn off the proxy for the scan. - 403 Forbidden or "no response" results. Cloudflare's WAF, Bot Fight Mode, or Security Level settings often block or challenge scanner traffic, because it looks like a malicious bot. The scan comes back with blocked requests instead of real findings, and an ASV can't mark that as a pass.
Fix: allow-list the scanner. - JS challenge or CAPTCHA pages instead of real content. If "I'm Under Attack Mode" or a JS or managed challenge is on, the scanner gets a challenge page instead of your site. That can produce a false pass (nothing to find) instead of an accurate result.
Fix: allow-list the scanner and turn off Under Attack Mode for the scan. - 522 or 524 timeout errors. Cloudflare couldn't get a timely answer from your origin. Usually the origin's firewall only allows Cloudflare's IP ranges and drops the ASV's scanning IPs, or the scan's traffic is hitting a rate limit somewhere along the way.
Fix: let the scanner's IPs through your origin firewall. - SSL/TLS certificate errors when scanning the origin IP directly. If you bypass Cloudflare and scan your origin's IP address, the certificate may not match that IP, since it's usually issued for the hostname. You get SSL findings that aren't a real-world risk.
Fix: scan by hostname, not bare IP. - Findings that describe Cloudflare's edge instead of your server. Cloudflare handles TLS and HTTP at its edge, so some findings (TLS cipher suites, HTTP headers, server banners) can reflect Cloudflare's settings rather than your server's. That leads to false positives or negatives if the scan isn't scoped right.
Fix: an allow-list won't change this one. Use the backup fix and turn off the proxy for the scan. - HSTS flagged as missing or weak, even though it's set correctly. Cloudflare has its own HSTS setting under SSL/TLS > Edge Certificates, separate from what your origin sends. If that setting is off, or its Max-Age, includeSubDomains, or preload options don't match, the scan can report Strict-Transport-Security as missing even when your origin is set up right. This is one of the most common false positives on scans that go through Cloudflare.
Fix: check the header your site really sends.
How to fix Cloudflare scan errors
Start with Fix A. Keep Fix B as a backup if the scan still fails. Then do the checks under "For either fix".
Recommended
Fix A: Allow-list the scanner
Cloudflare stays on and keeps protecting your site. Only your ASV's scanning IPs get through the WAF and bot checks.
Backup
Fix B: Turn off the proxy for the scan
Use it if the scan still fails, or the findings describe Cloudflare instead of your server. The scanner goes straight to your server, but the site loses Cloudflare's protection for the scan window.
Fix A: Allow-list the scanner in Cloudflare
With Cloudflare's proxy on, you have to let the scanner through. First, ask your ASV for its full list of scanning IPs, because most scanners use more than one address. If ServerScan runs your scans, our FAQ lists the range we use.
There are two ways to do it. A custom rule with the Skip action is better, because you pick exactly which protections the scanner skips. An IP Access rule is quicker, but it lets the scanner past more of your security.
Option 1 (recommended): a custom rule with the Skip action
- In the Cloudflare dashboard, open your site and go to Security > Security rules. In the older dashboard this is Security > WAF > Custom rules.
- Select Create rule, then Custom rules. Give it a clear name, such as "ASV scanner allow-list".
- Select Edit expression and enter your ASV's IP range, for example
(ip.src in {203.0.113.0/25}). Swap in the real addresses from your ASV. You can put several addresses or ranges inside the braces, separated by spaces. - Under Choose action, pick Skip. Then tick All remaining custom rules, All rate limiting rules and All managed rules. If your plan has Super Bot Fight Mode, tick All Super Bot Fight Mode rules too. In the list of other products you can skip, tick Security Level and Browser Integrity Check.
- Save the rule, then drag it to the top of your custom rules list. Rules run in order, so a Skip rule only skips the rules below it.
Option 2: an IP Access rule
- Go to Security > Security rules, then select Create rule, then IP access rules. In the older dashboard this is Security > WAF > Tools.
- Enter the scanner's IP address or range, set the action to Allow, and set it to apply to this website.
- Select Create. Add one rule for each address or range your ASV gave you.
Be careful with Option 2. Allow lets that IP skip your custom rules, rate limiting rules and WAF Managed Rules all at once. Use Option 1 if you want more control, and remove the rule as soon as the scan is done.
On the free plan? A custom rule can't skip Bot Fight Mode, because Cloudflare runs it separately from the WAF. An IP Access rule that matches first does stop it, but the simplest fix is to turn Bot Fight Mode off for the scan window. The same goes for "I'm Under Attack Mode".
While the scan runs, open your Security events log in Cloudflare. You should see your rule matching the scanner's requests, and no blocks or challenges against its IPs.
Fix B (backup): Turn off the proxy for the scan
Use this if the allow-list didn't clear the errors, or if the findings describe Cloudflare's edge instead of your server.
- Agree on a scan window with your hosting or network team, so everyone knows the change is temporary.
- In the Cloudflare dashboard, open your site and go to DNS > Records.
- Edit the record for the hostname being scanned, switch Proxy status to DNS only (grey cloud), and save. Wait a few minutes for the change to take effect.
- Run the scan. The scanner now reaches your origin server directly.
- When the scan finishes, switch Proxy status back to Proxied (orange cloud).
While the proxy is off, your origin IP is visible in DNS and Cloudflare isn't protecting the site. Keep the window short.
For either fix
- Open your origin firewall to the scanner. Make sure it allows both Cloudflare's published IP ranges and your ASV's scanning IPs. Otherwise requests get dropped and you see 522 or 524 timeouts.
- Scan by hostname, not bare IP. If your ASV has to scan the origin server directly to meet 11.3.2, give them the right hostname (or Host header) so your SSL certificate validates. To check which of your addresses belong in the scan, see our guide to which IP addresses to scan.
- Check the HSTS header your site really sends. Run
curl -sI https://yourdomain.comand look forStrict-Transport-Security: max-age=31536000; includeSubDomains; preload. If Cloudflare's HSTS setting (SSL/TLS > Edge Certificates > HSTS) is on and matches that value, the header is already correct. Ask your ASV for a false-positive exception instead of changing anything. If ServerScan is your ASV, here's how to request one. - Undo the temporary changes. Remove allow-list rules you no longer need, turn the proxy back on, and turn Bot Fight Mode or Under Attack Mode back on if you turned them off.
Still failing?
Compare the findings against the seven errors above. Most leftover failures are the HSTS false positive, an origin firewall that still drops the scanner, or findings about Cloudflare's edge, which only Fix B clears.