Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs-xml/error/CloudflareHttpError.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<fvdoc>
<div xmlns='http://www.w3.org/1999/xhtml'>
<div id='message'>
<p>HTTP Error</p>
</div>
<div id='explanation'>
<p>The feed couldn't be validated because there the validator was blocked by CloudFlare WebApp's Firewall. The validator can be identified by its User-Agent string <code>FeedValidator/1.3</code> to be specifically authorized to access that resource.</p>
</div>
<div id='solution'>
<p>Deactive the WebApp Firewall or allow-list the feedvalidator user agent <code>FeedValidator/1.3</code>.</p>
</div>
</div>
</fvdoc>
2 changes: 2 additions & 0 deletions docs-xml/error/HttpError.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ and make sure that the URL you supplied resolves to an accessible file.</p>
<p>This usually means that the URL was wrong, or that permissions on
the server don't allow us to fetch that file. The error shows the
message that the server sent, which may help.</p>

<p>If the error is "403 Forbidden" and your Web site uses a Web App Firewall, you may need to allow-list the feedvalidator User-Agent: <code>FeedValidator/1.3</code>.</p>
</div>
<div id='solution'>
<p>Make sure this URL can be downloaded with a browser, then try again.</p>
Expand Down
55 changes: 55 additions & 0 deletions docs/error/CloudflareHttpError.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!DOCTYPE html><html lang="en"><head>
<meta charset="utf-8">
<style type="text/css" media="screen">@import "../../css/common.css";
@import "../../css/validator.css";
@import "../../css/documentation.css";
@import "../../css/validator/base.css";
</style>
<title>Blocked by CloudFlare Web Apps Firewall</title>
</head>

<body>
<div id="banner">
<h1 id="title">
<a href="http://www.w3.org/"><img alt="W3C" id="logo" src="https://www.w3.org/assets/logos/w3c-2025/svg/margins/w3c-letters-bg-white.svg"></a>
<a href="./"><span>Feed Validation Service</span></a>
</h1>
<p id="tagline">Check the syntax of Atom or RSS feeds</p>
</div>
<div id="main" class="doc">
<h2>Message</h2>
<div class="docbody">
<p>Blocked by CloudFlare Web Apps Firewall</p>
</div>
<h2>Explanation</h2>

<div class="docbody">
<p>The feed couldn't be validated because there the validator was blocked by CloudFlare WebApp's Firewall. The validator can be identified by its User-Agent string <code>FeedValidator/1.3</code> to be specifically authorized to access that resource.

</div>
<h2>Solution</h2>
<div class="docbody">
<p>Deactive the WebApp Firewall or allow-list the feedvalidator user agent <code>FeedValidator/1.3</code>.</p>
</div>
<h2>Not clear? Disagree?</h2>
<div class="docbody">
<p>You might be able to find help in one of <a href="../howto/resources.html">these fine resources</a>.</p>
</div>

</div><!-- main -->
<ul class="navbar" id="menu">
<li>
<a href="../../" accesskey="1" title="Go to the Home Page for The W3C Feed Validation Service">Home</a></li>
<li><a href="../../about.html" title="Information About this Service">About...</a></li>
<li><a href="../../whatsnew.html" title="The changes made to this service recently">News</a></li>
<li><a href="../" accesskey="3" title="Documentation for this Service">Docs</a></li>
</ul>
<div id="footer">
<address>
This service uses the <a href="https://github.com/w3c/feedvalidator">Feed validator software</a>. Please report any <a href="https://github.com/w3c/feedvalidator/issues">issues on GitHub</a>.
</address>
</div>



</body></html>
2 changes: 1 addition & 1 deletion docs/error/HttpError.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h2>Explanation</h2>
the server don't allow us to fetch that file. The error shows the
message that the server sent, which may help.</p>

<p>If the error is "403 Forbidden" and your Web site uses a Web App Firewall, you may need to allow-list the feedvalidator User-Agent: "FeedValidator/1.3".
<p>If the error is "403 Forbidden" and your Web site uses a Web App Firewall, you may need to allow-list the feedvalidator User-Agent: <code>FeedValidator/1.3"</code>.</p>

</div>
<h2>Solution</h2>
Expand Down
2 changes: 2 additions & 0 deletions src/feedvalidator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ def validateURL(url, firstOccurrenceOnly=1, wantRawData=0, groupEvents=0):
raise

except urllib.error.HTTPError as status:
if status.code == 403 and status.headers.get("cf-mitigated") == "challenge":
ValidationFailure(logging.CloudflareHttpError({'status': status}))
raise ValidationFailure(logging.HttpError({'status': status}))
except urllib.error.URLError as x:
raise ValidationFailure(logging.HttpError({'status': x.reason}))
Expand Down
1 change: 1 addition & 0 deletions src/feedvalidator/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ class AtomLinkNotEmpty(Warning): pass
class UnregisteredAtomLinkRel(Warning): pass

class HttpError(Error): pass
class CloudflareHttpError(HttpError): pass
class IOError(Error): pass
class UnknownEncoding(Error): pass

Expand Down