publishpress / WordPress-EDD-License-Integration

Basic classes for WordPress to integrate with EDD license keys
Other
0 stars 1 forks source link

Add better debug options when a response code is different from 200 #5

Open andergmartins opened 2 years ago

andergmartins commented 2 years ago

In the validate_license_key method sometimes our site can return 403 due to Wordfence blocking the request for any reason.

Here is the returned body:

image

Our library will throw a InvalidRequest exception with the responseCode, but there is no way to see what was returned. Maybe we could have an option to activate an special debug page to see all the information by the last response?

It is important to help debugging access problems when customers try to activate licenses.

On our private internal documentation, there should have instructions about how to debug this kind of errors in EDD, looking for blocked requests on Wordfence: Worfence > Tools > Live traffic

andergmartins commented 2 years ago

Based on the returned body we can try to identify if it is a Wordfence answer, and display that in a more clear way on the error message, maybe displaying the IP address to make it easier to find it on the Wordfence logs.