This PR adds the Airstory\Connection\get_webhook_uri() function, which performs additional checks against the WP REST API before connecting to Airstory.
Rather than relying on the (self-reporting) output of get_rest_url(), get_webhook_uri() will send an HTTP HEAD request to that endpoint to see if any redirects are in-play. The resulting URI is then stored in the object cache, to be recalculated only when a significant change (such as a domain change) is made to the site.
This approach should help reduce the number of cases where the Airstory target and effective path (see this comment in #74 for details) do not match.
This PR adds the
Airstory\Connection\get_webhook_uri()
function, which performs additional checks against the WP REST API before connecting to Airstory.Rather than relying on the (self-reporting) output of
get_rest_url()
,get_webhook_uri()
will send an HTTPHEAD
request to that endpoint to see if any redirects are in-play. The resulting URI is then stored in the object cache, to be recalculated only when a significant change (such as a domain change) is made to the site.This approach should help reduce the number of cases where the Airstory target and effective path (see this comment in #74 for details) do not match.