yourivw / LEClient

An easy-to-use PHP ACME v2 client library, designed to be used with LetsEncrypt.
MIT License
204 stars 98 forks source link

Error 405 in Staging Mode #97

Closed Timur-O closed 4 years ago

Timur-O commented 4 years ago

This error only appears in staging mode, while everything works perfectly in production mode.

I get a 405 Method Not Allowed error after an order is created. This is what the error message thrown by the client looks like:

02-08-2020 16:50:29, function __construct (function get):
Array ( [request] => GET https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/87737641 [header] => HTTP/1.1 405 
Method Not Allowed Server: nginx Date: Sun, 02 Aug 2020 20:51:18 GMT Content-Type: application/problem+json Content- 
Length: 103 Connection: keep-alive Cache-Control: public, max-age=0, no-cache Link: ;rel="index" [status] => 405 [body] => 
Array ( [type] => urn:ietf:params:acme:error:malformed [detail] => Method not allowed [status] => 405 ) )

And this is what is returned by the Let's Encrypt API:

{ "type": "urn:ietf:params:acme:error:malformed", "detail": "Method not allowed", "status": 405 }

I saw that there was a previously resolved issue with this (#81), but I'm using the latest version (1.2.2) and still have this issue although the previous issue says it was resolved in version 1.2.0

yourivw commented 4 years ago

Unfortunately I can't reproduce the problem, and all tests are okay. Are you sure you are using the correct version? No GET requests should be made except from the initial directory request. In your case a GET request is made to an authorization URL. In the lastest version 1.2.2, all requests should be POST requests. If you have a look in LEAuthorization.php, you should see only POST requests being made $this->connector->post(...).

My advice is to check the version or reinstall it just to be sure and try again. I cannot find any other problems here.

The staging endpoint is not accepting GET requests anymore, the production endpoint still is, so that's why you're not having the issue in production.

Timur-O commented 4 years ago

Thank you, it turns out the issue was on my end. It was fixed upon reinstalling on my server. Apparently, I had two different versions installed locally and on my server.