I have a subdomain set up in Apache httpd, that is front-ending for a Tomcat server, with the httpd server secured by Let's Encrypt.
If I have the following rewrite active in the conf file, then certbot fails.
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
If I comment it out, then certbot works.
I'm not entirely sure, but I think it's 100% consistent. Of course, with challenge-caching, I can't get another meaningful test result for a full month after a successful renewal.
If I understand correctly, you want to redirect all non-HTTPS requests to HTTPS. So I guess your rewrites are in a
<VirtualHost *:80>
container, for a non-HTTPS site.Now you want to add another condition, to not redirect Lets Encrypt challenges. I think you're probably using the HTTP-01 challenge, which means you want to not redirect requests to
http://<YOUR_DOMAIN>/.well-known/acme-challenge/<TOKEN>
. So does the following work?Another approach, it will redirect http->https everything but /.well-known: