Why rewrite rules redirecting to HTTPS make challenge fail

I am running an apache server ubuntu 24.04.
I had redirected in the conf as follow port 80 to 443 :

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]

But this make renewal fail (sending 301)... do you know what? what should I do to keep the redirection?
Thanks

When you opened this thread in the Help section, you should have been provided with a questionnaire. Maybe you didn't get it somehow (which is weird), or you've decided to delete it. In any case, all the answers to this questionnaire are required:


Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. crt.sh | example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is:

I ran this command:

It produced this output:

My web server is (include version):

The operating system my web server runs on is (include version):

My hosting provider, if applicable, is:

I can login to a root shell on my machine (yes or no, or I don't know):

I'm using a control panel to manage my site (no, or provide the name and version of the control panel):

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot):

3 Likes

Sorry,
I did not think you needed al lithe information as it is a general question related to apache configuration.
server : ubuntu 24.04, apache, php8.1
hosting : OVH VPN
cerbot : 1.21.0

Log error : Timeout during connect (likely firewall problem)

Hint: The Certificate Authority failed to download the temporary challenge files created by Certbot. Ensure that the listed domains serve their content from the provided --webroot-path/-w and that files created there can be downloaded from the internet.

I have no error when erdirection is not enabled..

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