Random redirect loop?

Hello, I have had now for over 3 days problems with my website https://acasino.biz.
In these 3 days I have managed to fix the problem (so I thought), but every time it comes back after a short time period.

The problem is that the homepage gets into a redirect loop back to the same homepage.
acasino.biz 301 to
acasino.biz 301 to
acasino.biz 301 to
acasino.biz 301 to
acasino.biz 301 to etc…

Until the message pops up [ERR TOO MANY REDIRECTS] in chrome or any other browser.
Each time this problem occurs I manage to fix it, but now I come to the realisation that it is a temporary fix when I log in to the dashboard the error disappears.

Logging out of the website the problem comes back after 5 minutes to 2 hours or so.

I have tried everything, removing plugins, nginx configuration, htaccess but every single time it just comes back after a short time period. There is just no logics behind it (almost believe it is a random redirect loop?)

I must note that it is just the homepage. If you add /news or /videos or any other slug behind / it will pop up the post or page or 404 if you just added something random after the domain/

It almost looks like Cloudflare has some sort of cookie that causes the redirect loop?
that once I log in, somehow Cloudflare gets a message and makes the site available to everyone… But after a short time period when i log out it is looping the redirect again.

Because it’s weird that the problem is fixed once logged in the dashboard of the website.

Have you tried
https://support.cloudflare.com/hc/en-us/articles/115000219871-Troubleshooting-redirect-loop-errors

It’s working for me. Did you fix something?

You see that’s the problem unfortunately. Over the last 3 days I thought I fixed 30 times with every single solution out there either Cloudflare’s solution, really simple SSL, plesk solutions, nginx solutions, .htaccess solutions and the thing is the problem is in none of them…

It just randomly goes to a homepage redirect loop, and randomly disappears again. Right now it looks like it’s fixed, tomorrow it’s back on a homepage redirect loop, I try to tweak and fix it, it works again, next day it’s back on…

Yesterday I didn’t even tried to fix it when it was looping the homepage and it fixed itself an hour later… I have no clue what’s causing it and to troubleshoot a random occuring loop like this is terribly difficult.

(the page with a fix sent above) : I tried all of these solutions, but after a while when it seems fixed it will jump back on a loop in a few hours or the next day.

One thing I want to note is that the redirect loop is not from http to https.
It is a 301 to itself.

It’s like I have stated somewhere

https//domain.com 301 it to https//domain.com

So when it occurs and i check it online with the website “redirect checker” I can see that its exactly like mentioned above.
Meaning there’s no http to https back and forth, or www back to none www back to www.
Not at all like that, it’s https//homepage.com to https//homepage.com and when you try to go to
any page or post it works, it’s just the homepage doing this…

It’s driving me mad for 3 days now, especially when you think that there can be soo many elements at play here, nginx, apache, plesk, let’s encrypt, Cloudflare, wordpress wp-config, .htaccess, and each time one adjustment seems fixed but than pops up again (even when not trying to fix it it fixes itself and puts it back on the loop) im just out of ideas at this point… :frowning:

That’s quite the frustrating mystery.

Have you been checking your server logs? With Plesk, you should be able to track how deep the request goes until it gets redirected. You should be able to look at the NGINX and Apache logs.

hi, I just stumbled on the 301 loop again, while it worked perfectly yesterday night…

https//acasino.biz


301 Moved Permanently

Status: 301 Moved Permanently
Code: 301
Date: Tue, 28 May 2019 14:29:40 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
Set-Cookie: __cfduid=de780cd6def0b9fce64e64529bdae084e1559053779; expires=Wed, 27-May-20 14:29:39 GMT; path=/; domain=.acasino.biz; HttpOnly; Secure
X-Redirect-By: WordPress
Location: https://acasino.biz/
Last-Modified: Tue, 28 May 2019 14:25:33 GMT
Expires: Tue, 28 May 2019 15:25:33 GMT
Pragma: public
Cache-Control: max-age=3600, public
X-Powered-By: PleskLin
Vary: Accept-Encoding
X-Cache-Status: HIT
Expect-CT: max-age=604800, report-uri=“https://report-uri.Cloudflare.com/cdn-cgi/beacon/expect-ct
Server: Cloudflare
CF-RAY: 4de0ec0c794135be-LHR

https//acasino.biz/


301 Moved Permanently

Status: 301 Moved Permanently
Code: 301
Date: Tue, 28 May 2019 14:29:40 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
Set-Cookie: __cfduid=db48eed35aefa36f77128df421dc7f3b71559053780; expires=Wed, 27-May-20 14:29:40 GMT; path=/; domain=.acasino.biz; HttpOnly; Secure
X-Redirect-By: WordPress
Location: https://acasino.biz/
Last-Modified: Tue, 28 May 2019 14:25:33 GMT
Expires: Tue, 28 May 2019 15:25:33 GMT
Pragma: public
Cache-Control: max-age=3600, public
X-Powered-By: PleskLin
Vary: Accept-Encoding
X-Cache-Status: HIT
Expect-CT: max-age=604800, report-uri=“https://report-uri.Cloudflare.com/cdn-cgi/beacon/expect-ct
Server: Cloudflare
CF-RAY: 4de0ec107cadce23-LHR

https//acasino.biz/


301 Moved Permanently

Status: 301 Moved Permanently
Code: 301
Date: Tue, 28 May 2019 14:29:41 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
Set-Cookie: __cfduid=dd76befb288bfd589fcb9a08fa7bb8da31559053780; expires=Wed, 27-May-20 14:29:40 GMT; path=/; domain=.acasino.biz; HttpOnly; Secure
X-Redirect-By: WordPress
Location: https://acasino.biz/
Last-Modified: Tue, 28 May 2019 14:25:33 GMT
Expires: Tue, 28 May 2019 15:25:33 GMT
Pragma: public
Cache-Control: max-age=3600, public
X-Powered-By: PleskLin
Vary: Accept-Encoding
X-Cache-Status: HIT
Expect-CT: max-age=604800, report-uri=“https://report-uri.Cloudflare.com/cdn-cgi/beacon/expect-ct
Server: Cloudflare
CF-RAY: 4de0ec127f8834e0-LHR

https//acasino.biz/


301 Moved Permanently

Status: 301 Moved Permanently
Code: 301
Date: Tue, 28 May 2019 14:29:41 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
Set-Cookie: __cfduid=de02f69fb90fb2bf58d7402a0547a3c791559053781; expires=Wed, 27-May-20 14:29:41 GMT; path=/; domain=.acasino.biz; HttpOnly; Secure
X-Redirect-By: WordPress
Location: https//acasino.biz/
Last-Modified: Tue, 28 May 2019 14:25:33 GMT
Expires: Tue, 28 May 2019 15:25:33 GMT
Pragma: public
Cache-Control: max-age=3600, public
X-Powered-By: PleskLin
Vary: Accept-Encoding
X-Cache-Status: HIT
Expect-CT: max-age=604800, report-uri=“https://report-uri.Cloudflare.com/cdn-cgi/beacon/expect-ct
Server: Cloudflare
CF-RAY: 4de0ec13ed723462-LHR

It seems that it is being redirected by WordPress.
I am getting a 302 when I try it.

I can confirm the redirection. Do you have any page rule?

To put your theory to the test, try bypassing Cloudflare (:orange: => :grey:) and check the website.

I have bypassed Cloudflare page rules and DNS and got this result :slight_smile:

https://acasino.biz


301 Moved Permanently

Status: 301 Moved Permanently
Code: 301
Server: nginx
Date: Tue, 28 May 2019 15:03:34 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
Location: https://acasino.biz/
Last-Modified: Tue, 28 May 2019 14:25:33 GMT
Expires: Tue, 28 May 2019 15:25:33 GMT
Pragma: public
Cache-Control: max-age=1319, public
ETag: “d41d8cd98f00b204e9800998ecf8427e”
X-Powered-By: PleskLin
X-Cache-Status: MISS

https://acasino.biz/


301 Moved Permanently

Status: 301 Moved Permanently
Code: 301
Server: nginx
Date: Tue, 28 May 2019 15:03:34 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
Location: https://acasino.biz/
Last-Modified: Tue, 28 May 2019 14:25:33 GMT
Expires: Tue, 28 May 2019 15:25:33 GMT
Pragma: public
Cache-Control: max-age=1319, public
ETag: “d41d8cd98f00b204e9800998ecf8427e”
X-Powered-By: PleskLin
X-Cache-Status: HIT

https://acasino.biz/


301 Moved Permanently

Status: 301 Moved Permanently
Code: 301
Server: nginx
Date: Tue, 28 May 2019 15:03:35 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
Location: https://acasino.biz/
Last-Modified: Tue, 28 May 2019 14:25:33 GMT
Expires: Tue, 28 May 2019 15:25:33 GMT
Pragma: public
Cache-Control: max-age=1319, public
ETag: “d41d8cd98f00b204e9800998ecf8427e”
X-Powered-By: PleskLin
X-Cache-Status: HIT

https://acasino.biz/


301 Moved Permanently

Status: 301 Moved Permanently
Code: 301
Server: nginx
Date: Tue, 28 May 2019 15:03:35 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
Location: https://acasino.biz/
Last-Modified: Tue, 28 May 2019 14:25:33 GMT
Expires: Tue, 28 May 2019 15:25:33 GMT
Pragma: public
Cache-Control: max-age=1319, public
ETag: “d41d8cd98f00b204e9800998ecf8427e”
X-Powered-By: PleskLin
X-Cache-Status: HIT

The it is certainly a problem at your server side. If is is intermittent, there is a high chance it is dynamic which means redirection is made by code.

As mentioned before, it is just the homepage everything else behind the / works as you can see below

https://acasino.biz/casino-offers/


200 OK

Status: 200 OK
Code: 200
Server: nginx
Date: Tue, 28 May 2019 15:06:50 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
Vary: Accept-Encoding
Link: https://acasino.biz/wp-json/; rel=“https://api.w.org/
Last-Modified: Tue, 28 May 2019 15:06:16 GMT
Expires: Tue, 28 May 2019 16:06:16 GMT
Pragma: public
Cache-Control: max-age=3566, public
ETag: “5b32888effd2aa5395a5457237c1354a”
X-Powered-By: PleskLin
X-Cache-Status: MISS

I have this in my Nginx directive :

location ~* .(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
expires max; log_not_found off;
}

gzip on;
gzip_disable “MSIE [1-6]\.(?!.*SV1)”;
gzip_proxied any;
gzip_comp_level 5;
gzip_types text/plain text/css application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon image/bmp image/svg+xml;
gzip_vary on;

if (!-e $request_filename) {
set $test P;
}
if ($uri !~ ^/(plesk-stat|webstat|webstat-ssl|ftpstat|anon_ftpstat|awstats-icon|internal-nginx-static-location)) {
set test "{test}C";
}
if (test = PC) { rewrite ^/(.*) /index.php?$1;
}

That line causes redirection.

2 Likes

I now see the redirect done by Cloudflare, but this time around without the X-Redirect-By: WordPress header. From https onto itself. Same location header over and over.

EDIT: One interesting thing I noticed while this page was being redirected by Cloudflare (the home page was working at the time of writing this) was that the size of initial redirect was one, followed by two different sizes alternated irregularly.

Initial: 337B
Second: 89B
Third: 50B

I don’t know what this discrepancy means; I’m just posting this here so that perhaps it gives a hint to others as to what may be at play.

The saved HAR file uploaded to Google Suite HAR Analyzer showed that the request had in all cases 901 bytes, while the response was always 564 bytes.

This topic was automatically closed after 30 days. New replies are no longer allowed.