Cloudflare and 403 error

Support requests, bug reports, etc. go here. Dedicated servers / VDS hosting only
Bear Rating Trainee
Bear Rating Trainee
Posts: 1
Joined: 26 Apr 2015, 15:27

Cloudflare and 403 error

Postby edgreenberg » 07 Oct 2016, 05:28

I used to read a feed at until it stopped working. Investigation showed that it was returning 403, and that Cloudflare was involved.

I found that adding an Accept: header caused Cloudflare to allow the connection.

I made that change to my copy of include/functions.php, but have no idea how to submit it to be considered for the next release.

Will somebody please advise me?

Here is the git diff:

Code: Select all

diff --git a/include/functions.php b/include/functions.php
index 3dea567..f9cd5c2 100755
--- a/include/functions.php
+++ b/include/functions.php
@@ -467,12 +467,13 @@
                  'http' => array(
                      'method' => 'GET',
                      'protocol_version'=> 1.1,
-                     'header' => "If-Modified-Since: ".gmdate("D, d M Y H:i:s \\G\\M\\T\r\n", $timestamp)
+                     'header' => "Accept: application/atom+xml,application/rss+xml;q=0.9,application/rdf+xml;q=0.8,application/xml;q=0.7,text/xml;q=0.7,*/*;q=0.1\r\nIf-Modified-Since: ".gmdate("D, d M Y H:i:s \\G\\M\\T\r\n", $timestamp)
          } else {
              $context = stream_context_create(array(
                  'http' => array(
                      'method' => 'GET',
+                     'header' => "Accept: application/atom+xml,application/rss+xml;q=0.9,application/rdf+xml;q=0.8,application/xml;q=0.7,text/xml;q=0.7,*/*;q=0.1\r\n",
                      'protocol_version'=> 1.1

User avatar
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia

Re: Cloudflare and 403 error

Postby fox » 07 Oct 2016, 07:39

i'm not sure why i should add arbitrary client headers because cloudflare

maybe they should consider respecting standard http instead

Return to “Support”

Who is online

Users browsing this forum: No registered users and 12 guests