HTTP to HTTPS redirect causes ERR_TOO_MANY_REDIRECTS on ngrok
-
Hello,
I activated HTTPS on Laragon, redirecting automatically all HTTP requests to HTTPS through.htaccess
:<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] </IfModule>
Everything is fine except when I use ngrok, because I get an
ERR_TOO_MANY_REDIRECTS
error.
I tried with some sites (Laravel, Wordpress, custom ones) but I always end with that error...I can remove the
.htaccess
rule, temporarily, but is there a more pleasant solution? Thanks
-
Still not fixed in most recent versions of Laragon (4.0.15 190704) + ngrok (2.3.34) but managed to use a temporary hack just for shared link to be usable even without https. Here I managed to force https for local access only, but not if thru ngrok.io:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTPS} off RewriteCond %{SERVER_NAME} !.*\.ngrok\.io$ RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L] </IfModule>
Note that
%{SERVER_NAME}
was used instead of%{HTTP_HOST}
.I am not very comfortable using non-https access, especially if I'm sharing to users that are not security conscious.