• Resolved divv

    (@divv)


    Hi, great plugin!

    My only issue is that authentication does not work for cached pages/posts created with the WP REST Cache plugin (https://wordpress.org/plugins/wp-rest-cache/). Basically, if a page/post is NOT cached authorization works fine, if the page/post IS cached it gets delivered even though no authorization header is set.

    I understand that this is somewhat out of your control but it would be so nice if these two plugins could work together. I guess that the mechanism which verifies the Bearer token has to be added to the function which retrieves the cached pages/posts just as it does on a “normal request”.

    As of now one has to choose one or the either of these plugins, fast retrieval or secure retrieval of data 😀

    Or is there any other solution?

    (I will post this on WP REST Cache as well)

    Kind regards
    David

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author miniOrange

    (@cyberlord92)

    Hi David,

    Thanks for pointing this out.
    We are looking into this issue and soon provide a solution on this.

    Plugin Author miniOrange

    (@cyberlord92)

    Please add the below code in WP REST Cache plugin -> wp-rest-cache/wp-rest-cache.php and it would fix the issue for wp/v2/posts and wp/v2/comments APIs.

    function wprc_unregister_wp_comments_endpoint( $allowed_endpoints ) {
        if ( isset( $allowed_endpoints[ 'wp/v2' ] ) && ( $key = array_search( 'comments', $allowed_endpoints[ 'wp/v2' ] ) ) && ( $key = array_search( 'posts', $allowed_endpoints[ 'wp/v2' ] ) ) !== false ) {
            unset( $allowed_endpoints[ 'wp/v2' ][ $key ] );
        }
        return $allowed_endpoints;
    }
    add_filter( 'wp_rest_cache/allowed_endpoints', 'wprc_unregister_wp_comments_endpoint', 100, 1);
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Support for WP REST Cache’ is closed to new replies.