- Issue created by @BramDriesen
- Status changed to Closed: works as designed
over 1 year ago 6:04am 10 August 2023 - 🇧🇪Belgium BramDriesen Belgium 🇧🇪
Not sure where my head was when creating this issue. But the request should go to drupal...
I am using the core .htaccess file with no changes as it is compliant with with RFC 5785 and allows the challenge. The only change we have is to enforce http -> https
However, when I try to access the URL via curl, I'm being redirected to the index.php of the site because of the following section.
# Pass all requests not referring directly to files in the filesystem to
# index.php.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]
I'm no expert at this, but I think this is happening because the challenge is not an actual file on the webserver.
- Drupal 9 site with this module
- Configure a challenge
- Plain .htaccess from core with no changes
- request the challenge over http
❯ curl -k -L -v http://mysite.be/.well-known/acme-challenge/123456 2>&1 | egrep "^> (Host:|GET)"
> GET /.well-known/acme-challenge/123456 HTTP/1.1
> Host: mysite.be
> GET /index.php HTTP/2
> Host: mysite.be
> GET / HTTP/2
> Host: mysite.be
Changing this to the following solves the issue.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
# Don't redirect for .well-known requests because we use the letsencrypt_challenge module.
RewriteCond %{REQUEST_URI} !^\/\.well-known\/.*$
RewriteRule ^ index.php [L]
If this is the way to go, I think we should create a documentation page explaining the steps needed for Drupal 8+
Create documentation + readme?
Closed: works as designed
1.0
Code
Not sure where my head was when creating this issue. But the request should go to drupal...