ERR_TOO_MANY_REDIRECTS with Apache

6 posts / 0 new
Last post
#1 Thu, 08/29/2019 - 11:28
Felipe Sanchez

ERR_TOO_MANY_REDIRECTS with Apache

Hello everyone.

I have a clean installation of Virtualmin and I have created a new virtual server with SSL enabled. I have created the following permanent redirect so that the http traffic on port 80 is redirected to https: Captura

later when I navigate to http://domain.com I get the typical ERR_TOO_MANY_REDIRECTS

i am using apache

Thu, 08/29/2019 - 12:02
scotwnw

You're redirecting from /(root) to https://(root) which is a circle, root to root. It might work by going from / to https://domain.com/index.php

But I've done it like this. /index.php to https://domain.com/index.php. If your index file is not php, then put index.html or what ever it happens to be.

Thu, 08/29/2019 - 15:09
Felipe Sanchez

Thanks for your response, I really don't want to go to index.php, I want to redirect any traffic from http to https, whatever the url.

Thanks again, I understood the problem thanks to you but I don't know how to fix it

Thu, 08/29/2019 - 15:24
Felipe Sanchez

Even so I only have the redirection on port 80, not on 443, it is assumed that a request is first made to port 80, which has a redirection to https on port 443 and as on the server that listens on port 443 I don't have any redirection I should stay there and not redirect

Thu, 08/29/2019 - 21:19
Felipe Sanchez

I have placed the following in .htaccess:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://domain.com/$1 [R,L]


I keep getting the same error. I can't understand how applying the condition of port 80 continues to get that error.

The .htaccess file works runs well so that is not the problem

Thu, 08/29/2019 - 21:47
Felipe Sanchez

I have finally managed to solve the problem. It was not a virtualmin problem if not my DNS (Cloudflare and my router).

Port 443 was not open due to a problem in the router (it seems that it has that little bug) and cloudflare detected that and redirected traffic 443 to 80, and my server 80 to 443 thus entering a loop