Problem accessing a web page / redirection to page 404 / certificate error.

prettyallo

Registered
Jul 11, 2021
4
0
1
Belgique
cPanel Access Level
Website Owner
Personally, I find it hard to pinpoint my problem. And I still don't know who is the real culprit of this problem.
- Either it's magento 2.4
- Or it's Cpanel
- Or it's getssl/certbot.

Anyway I explain you my problem for two weeks now:
I have a website with magento 2.4.2 . I get and install my certificates with getssl (on letsencrypt). I have been using getssl for two years now to get/renew my site's certificate without any problem. Of course I use "Cpanel -> SSL/TLS -> CERTIFICATES (CRT)" to load the obtained certificate files into my site.

My certificate expired two weeks ago, but when I tried to renew it with getssl, I got this error message:
Code:
getssl: for some reason could not reach http://mydomaine.com/.well-known/acme-challenge/UeI1tA5P327xxxxxxxxxxxx - please check it manually
I obviously started by Googling this error message. And none of the proposed solutions solved my problem (make the acme-challenge folder read/write, give the rights, etc...).
I decided to try to get the certificate with Certbot, another software. But even it displays an error more or less similar to the one from getssl:

Code:
Certbot failed to authenticate some domains (authenticator: webroot). The Certificate Authority reported these problems:
  Domain: myDomainne.com
  Type:   unauthorized
  Detail: Invalid response from https:// myDomainne.com/.well-known/acme-challenge/ol1rea7iliOIckxxxxxxxxxxxxxxx [2001:41d0:xxx:xxx::xxx]: "<!doctype html>\n<html lang=\"fr\">\n    <head >\n        <script>\n    var BASE_URL = 'https\\u003A\\u002F\\u002FmyDomainne.com\\u002Ffr\\"
Basically, if I understand correctly, the two can't reach the content of this URL:
http://myDomainne.com/.well-known/acme-challenge/Txt_files_xxxxxxxxxxxxxxx Finally, to check the challenge.

To check this I simply created a "test.txt" file in the /.well-known/acme-challenge/ test.txt directory in which I just put the word 'success' and saved.
When I try to access the contents of my file from a web browser

http://myDomainne.com/.well-known/acme-challenge/test.txt

I can't get it to work. It always redirects me to the "404 Not found" page, instead of displaying the 'success' content of my test.txt file.

I think it's a redirection problem caused by Cpanel or magento2.
I'm not able to validate my challenge, so I can't get a certificate for my domain.
I'm not sure if this is a problem or not, but I'd like to know how to fix it.


Thank you
 
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
7,519
1,028
313
cPanel Access Level
Root Administrator
Hey there! Great job troubleshooting this up to this point! Since the plain text.txt file doesn't work in a browser, it is almost certainly something with the Magento installation causing the redirect.

A quick test would be to try temporarily renaming the .htaccess file for the domain to .htaccess.bak so it can't be used by the system, and then see if the test.txt file will load. If so, there is either a .htaccess redirect in place causing this, or something in Magento causing this. I'm not aware of anything on the cPanel side of things that would keep that file from loading normally.

Let us know what you find!
 
  • Like
Reactions: prettyallo

prettyallo

Registered
Jul 11, 2021
4
0
1
Belgique
cPanel Access Level
Website Owner
Hey there! Great job troubleshooting this up to this point! Since the plain text.txt file doesn't work in a browser, it is almost certainly something with the Magento installation causing the redirect.

A quick test would be to try temporarily renaming the .htaccess file for the domain to .htaccess.bak so it can't be used by the system, and then see if the test.txt file will load. If so, there is either a .htaccess redirect in place causing this, or something in Magento causing this. I'm not aware of anything on the cPanel side of things that would keep that file from loading normally.

Let us know what you find!

Hello Jurasssic
First of all sorry for the very late feedback. .
It was a redirection problem due to the .htaccess file.
To solve it I simply commented/rename all the .htaccess file and tried again to execute the command to get the certificate.
And it worked , it was able to check the chalenge on with the url : https:// myDomainne.com/.well-known/acme-challenge/ol1rea7iliOIckxxxxxxxxxxxxxxx


Thanks again for your help.