Redirect Let's Encrypt challenge

My domain is: bluedental.pl

I ran this command: certbot certonly --webroot -w /etc/nginx/token -d bluedental.pl -d www.bluedental.pl -d validation.bluedental.pl

It produced this output:
output

My web server is (include version): local

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

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

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

nginx config file bluedental.pl
server {
server_name bluedental.pl www.bluedental.pl;
location /.well-known/acme-challenge/ {
return 301 “http://validation.bluedental.pl/.well-known/acme-challenge/”;
}
location / {
}
}

nginx config file validation.bluedental.pl
server {
server_name validation.bluedental.pl www.validation.bluedental.pl;

location / {
root /etc/nginx/token/;
}
}

You're chopping off the last part of the request path in this redirect.

Perhaps:

location ~ ^/\.well-known/acme-challenge/([-_a-zA-Z0-9]+)$ {
  return 301 "http://validation.bluedental.pl/.well-known/acme-challenge/$1";
}

Edit; tried to remove fancy quotes

Looking better! The redirect properly contains the token now.

“Error getting validation data” is a sort of catch-all error. In your specific case, it’s happening because of weird quoting being applied to the Location header in your redirect.

Would you be able to replace the quotes in the return 301 line with normal double quotes?

I think the forum has inserted fancy quotes inadvertently …

Are you sure you got rid of them and reloaded nginx? I still see them.

$ curl -X GET -I bluedental.pl/.well-known/acme-challenge/xx 2>/dev/null \
| grep -P "[^\x00-\x7F]"
Location: “http://validation.bluedental.pl/.well-known/acme-challenge/xx”
1 Like

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