• swg proxy + docker + wordpress image latest == php 8.2.25

    Hi, I get this message with the normal test: The REST API encountered an unexpected result

    The REST API is one way that WordPress and other applications communicate with the server. For example, the block editor screen relies on the REST API to display and save your posts and pages.

    When testing the REST API, an unexpected result was returned:

    REST API Endpoint: https://yourdomain.com/wp-json/wp/v2/types/post?context=edit
    REST API Response: (403) Forbidden

    On pasting this URL (https://example.com.test/wp-json/wp/v2/types/post?context=edit) in the browser, I get {“code”:”rest_forbidden_context”,”message”:”Sorry, you are not allowed to edit posts in this post type.”,”data”:{“status”:401}}

    If I change this URL to context=view (https://example.com.test/wp-json/wp/v2/types/post?context=view) in the browser, I get

    {“description”:””,”hierarchical”:false,”has_archive”:false,”name”:”Posts”,”slug”:”post”,”icon”:”dashicons-admin-post”,”taxonomies”:[“category”,”post_tag”],”rest_base”:”posts”,”rest_namespace”:”wp\/v2″,”_links”:{“collection”:[{“href”:”https:\/\/example.com.test\/wp-json\/wp\/v2\/types”}],”wp:items”:[{“href”:”https:\/\/example.com.test\/wp-json\/wp\/v2\/posts”}],”curies”:[{“name”:”wp”,”href”:”https:\/\/api.w.org\/{rel}”,”templated”:true}]}}

    Both seem to indicate that REST API is working, so what’s wrong and why is the test failing? I suspect your plugin was not vetted against PHP 8. The details indicate you tested it up to PHP 7.3.

    The wordpress image provided by WordPress is using PHP 8. Were you aware?

Viewing 1 replies (of 1 total)
  • Site Health (without this plugin, by the way) checks the REST API by calling /wp-json/wp/v2/posts from the local server on which WordPress is installed. It could be that it receives an incorrect response there, e.g. if the domain is not routed correctly. I would recommend that you contact your hoster’s support team, they may be using a security tool that is interfering with this.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.