Drupal 10, the latest version of the open-source digital experience platform with even more features, is here.The documentation indicates that /.well-known/acme-challenge/ should remain accessible via HTTP, without forced redirection to HTTPS:
Test the challenge directory
Create a file e.g. called index.html in /var/aegir/config/letsencrypt.d/well-known/acme-challenge/ and test if you can access it over http via http://www.example.com/.well-known/acme-challenge/index.html
If your request is redirected to a https url then that could pose a problem when the certificate there is either invalid or expired. Try to remove the redirects.
At the moment, if for a site "my.site.com" we choose HTTPS Required (which seems to be generally a sensible choice), then ALL http requests get rewritten to https through the following mod_rewrite block in the site's apache config:
$ cat /var/aegir/config/server_master/apache/vhost.d/my.site.com
[...]
# Redirect aliases in non-ssl to the same alias on ssl.
RewriteRule ^/*(.*)$ https://%{HTTP_HOST}/$1 [NE,L,R=301]
[...]Would that make sense to exclude /.well-known/acme-challenge to that rewrite so that we can safely choose HTTPS Required with Let's Encrypt?
I have tried the following configuration which seemed to do it:
$ cat /var/aegir/config/server_master/apache/vhost.d/my.site.com
[...]
# Redirect aliases in non-ssl to the same alias on ssl, except for /.well-known/acme-challenge/ URIs
RewriteCond %{REQUEST_URI} "!/.well-known/acme-challenge/"
RewriteRule ^/*(.*)$ https://%{HTTP_HOST}/$1 [NE,L,R=301]
[...]I looked for the piece of code that inserted that block in the configuration, to test it further and suggest a patch, but I could not find it anywhere.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 2952366-provision-except-well-known-2.patch | 1.8 KB | helmo |
| #6 | 2952366-hosting_https-except-well-known.patch | 853 bytes | helmo |
| #4 | ExcludeAcmeChallengeFromHttpsRequired-2952366.patch | 735 bytes | agaq |











Comments
Comment #2
helmo CreditAttribution: helmo at Initfour websolutions for Aegir Cooperative commentedThat's in the http/Provision/Config/Apache/vhost.tpl.php file in the provision repo. It's included from submodules/apache_https/drush/Provision/Config/Apache/Https/vhost_https.tpl.php in the hosting_https repo.
Are you seeing errors from this? As far as I know redirecting is os as long as it's on the same hostname.
Comment #3
agaq CreditAttribution: agaq as a volunteer commentedI have not yet seen errors on this.
The documentation says that redirecting /.well-known/acme-challenge/index.html from http to https causes problem, so I just wanted to make using the safest configuration "HTTPS required" less prone to potential problems.
It does not seem to be in submodules/apache_https/drush/Provision/Config/Apache/Https/vhost_https.tpl.php though.
Setting a site to "HTTPS required" inserts in the site config the two lines
While what we have in vhost_https.tpl.php shows a different comment line:
I have searched for the text "non-ssl" in scripts but could not find any occurrence.
Comment #4
agaq CreditAttribution: agaq as a volunteer commentedI am a bit slow but I finally figured out I had to look at provision, not hosting_https...
Here is a proposed patch.
But I don't know how to transfer that issue from hosting_https to provision.
Comment #5
helmo CreditAttribution: helmo at Initfour websolutions for Aegir Cooperative commentedmoving... looks good at first glance.
Comment #6
helmo CreditAttribution: helmo at Initfour websolutions for Aegir Cooperative commentedI havn't yet fully verified it, but it seems to me that the same RewriteCond would also be needed in two other places.
Comment #7
memtkmcc CreditAttribution: memtkmcc at Omega8.cc commentedNote that we have fixed this problem in BOA (which still depends on legacy `hosting_le` project), a long time ago, and this code is present in Provision both in plain HTTP and HTTPS vhosts templates, where we are conditionally adding BOA specific location alias just before any redirect is triggered, like this:
This could be easily extended for non-BOA Nginx based Aegir with simple `else {}` alternative, I guess?
Comment #8
helmo CreditAttribution: helmo at Initfour websolutions for Aegir Cooperative commentedI'm leaning towards rtbc here ... but it would be nice to have a matching nginx patch.
Comment #9
memtkmcc CreditAttribution: memtkmcc at Omega8.cc commentedTrying to figure out how to replicate the same logic in Nginx without creating duplicate location here, since simple conversion from
RewriteCondtoif {}in Nginx is not really the best idea, but perhaps the only actually working.Comment #10
helmo CreditAttribution: helmo at Initfour websolutions for Aegir Cooperative commentedIt might be better to focus on matching nginx support in a separate issue... rtbc
Comment #11
helmo CreditAttribution: helmo at Initfour websolutions for Aegir Cooperative commentedIn #2975116: Disabled Sites are reachable via SSL but not renewable valkum mentions that we also need to look at disabled sites.
Here's an updated provision patch.
Comment #13
helmo CreditAttribution: helmo at Initfour websolutions for Aegir Cooperative commentedI've nog committed #11 and the hosting_https patch from #6