0

I have a web server that redirects any HTML 404 error to another domain:

ErrorDocument 404 https://error domain

My goal if to avoid redirection when Let’s Encrypt tries to renew the certificates.

All Let’s Encrypt challenges starts with: /.well-known/acme-challenge/

I have tried this:

ErrorDocument 404 https:// error domain
RewriteEngine on
Redirect "/.well-known/acme-challenge/" "/.well-known/acme-challenge/"

But I have the error "too many redirects" (and I understand why... :/). It is important that Let’s Encrypt works without human interaction, temporary modify the vitualhost is forbidden, for this I need that when a uri starts with:

/.well-known/acme-challenge/ ... etc -> no redirection
/anotherstring/ ect.. -> https://error domain

I am sure that this will solve my problem, because if I delete

ErrorDocument 404 https://error domain

then Let’s Encrypt renewal works.

KazikM
  • 215
  • 1
  • 3
  • 11

1 Answers1

0
<LocationMatch "!/\.well-known/acme-challenge/">
  ErrorDocument 404 https://error.domain
</LocationMatch>
Andrew Schulman
  • 8,811
  • 21
  • 32
  • 47