• Resolved lechon

    (@lechon)


    When upgraded from v2.9 to Version 3.2.2 Image Optimization stopped working.

    Under the old version I have already 56,269 images optimized, but none under Version 3.2.2.

    I keep getting the Current image limit is: 1, but not even a single image gets process.

    I have cleaned up unfinished data and request again but nothing happens and it goes back to Current limit is: 1

    I have read about the topic here:

    https://wordpress.org/support/topic/image-optimization-issue-on-v3/

    When i was using version 2.9 it took about 2 months for the 56,269 images to get optimized. the recommendation here is to Destroy All Optimization Data to start over (this is recommended).

    1. How long will it take again under the new version 3.2.2 to complete the job?

    2. Do I need to back up the database to do this?

    LiteSpeed Report number: PLYUPLYH

    Using ListeSpeed Server Enterprise

Viewing 9 replies - 16 through 24 (of 24 total)
  • Thread Starter lechon

    (@lechon)

    Hello @qtwrk

    We updated to Version 3.2.3.1 on our test server and implanted the code as you have suggested.

    It did work, but we had to disable it because it virtually gives access to everyone to REST API information defeating the purpose of the initial code.

    It’s not white listing LiteSpeed in a sense, it just disables completely the original REST API restrictions.

    This is the code we tested per your suggestion:

    //Restricts REST API Access
    add_filter( ‘rest_authentication_errors’, function( $result ) {
    if ( ! empty( $result ) ) {
    return $result;
    }
    if ( ! is_user_logged_in() && ( ! defined( ‘LSCWP_V’ ) || ! apply_filters( ‘litespeed_is_from_cloud’, false ) ) ) {
    return new WP_Error( ‘rest_not_logged_in’, ‘You do not have sufficient permission to access this endpoint. Access to REST API requests is restricted.’,
    array( ‘status’ => 401 ) );
    }
    return $result;
    });

    Best regards,

    Thread Starter lechon

    (@lechon)

    Hello @qtwrk

    We updated to Version 3.2.3.2 on our Test server and implemented a code that would work for our server.

    It did work, and image optimization seems to be working OK.

    Because this is a code we made up from 3 different sources we wanted to make sure that it’s all good with LiteSpeed.

    How can I post this code here for you to review?

    Best regards,

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    Because this is a code we made up from 3 different sources we wanted to make sure that it’s all good with LiteSpeed.

    How can I post this code here for you to review?

    I’m sorry I am not sure what you mean?

    but if you have trouble to implement our API , certainly , post your code and we can check.

    Best regards,

    Thread Starter lechon

    (@lechon)

    @qtwrk

    Hi,

    Sorry for the confusion.

    This is the code we implemented on our staging site and it seems to work OK on our end. Please take a look at and let us know if this code would cause any other conflicts with LiteSpeed.

    //Restricts REST API Access With LiteSpeed Cache Modification
    add_filter( ‘rest_authentication_errors’, function( $result ) {
    if ( ! empty( $result ) ) {
    return $result;
    }
    $allowedAddress = array( ‘54.252.210.186’,’35.178.212.86′,’13.233.85.71′,’37.120.131.40′,’5.134.119.194′,’165.227.116.222′,’92.38.139.226′,’213.159.1.75′,’197.189.253.162′,’185.149.235.173′,’184.73.187.186′,’44.233.72.214′,’52.59.41.24′,’18.179.116.177′,’34.226.106.116′,’31.22.115.186′,’199.59.247.242′,’146.88.239.197′,’185.25.204.8′,’79.172.239.249′,’92.38.132.176′,’5.196.169.11′,’31.220.21.249′,’38.129.107.18′,’49.12.102.29′,’51.68.231.18′,’51.222.28.21′,’64.227.16.93′,’64.227.37.171′,’94.75.232.90′,’142.93.158.152′,’157.230.17.241′,’161.35.28.150′,’167.99.75.70′,’185.53.57.89′,’185.53.57.94′,’185.53.57.240′,’185.53.57.254′,’188.166.12.178′,’192.99.38.117′,’212.162.151.34′,’213.184.87.74′,’213.184.87.75′,’18.188.223.222′,’3.122.18.67′ );
    $requestServer = $_SERVER[‘REMOTE_ADDR’];

    if( ! in_array( $requestServer, $allowedAddress ) )
    if ( ! is_user_logged_in() ) {
    return new WP_Error( ‘rest_not_logged_in’, ‘You do not have sufficient permission to access this endpoint. Access to REST API requests is restricted.’,
    array( ‘status’ => 401 ) );
    }
    return $result;
    });

    Best regards,

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    You don’t need to do it this way , the IPs are changed every now and then we add or remove nodes , so it is better to use API which is constantly pulling the latest IP list.

    Best regards,

    Thread Starter lechon

    (@lechon)

    @qtwrk

    We can Not make it work without listing the LiteSpeed IPs. We tried so many different combinations but nothing seems to work. This is that last code we tried not using IPs:

    //Restricts REST API Access With LiteSpeed Cache Modification
    add_filter( ‘rest_authentication_errors’, function( $result ) {
    if ( ! empty( $result ) ) {
    return $result;
    }
    if ( ! is_user_logged_in() && ( ! defined( ‘LSCWP_V’ ) || ! apply_filters( ‘litespeed_is_from_cloud’, false ) ) ) {
    return new WP_Error( ‘rest_not_logged_in’, ‘You do not have sufficient permission to access this endpoint. Access to REST API requests is restricted.’,
    array( ‘status’ => 401 ) );
    }
    return $result;
    });

    This is the error we get:
    Cloud Error: Please try after 3m 5s for service img_optm-new_req.

    Best regards,

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    Cloud Error: Please try after 3m 5s for service img_optm-new_req.

    this is normal response , there is a time limit on image request , wait for 3 minutes and then you should be able to send next request.

    if you have enabled automated optimization , you don’t need to manually send it.

    Best regards,

    Thread Starter lechon

    (@lechon)

    @qtwrk

    Hi,

    Thanks for that information. We finally got it to work!

    Thanks for all your help.

    Cheers!

    Plugin Support qtwrk

    (@qtwrk)

    Glad to know !

Viewing 9 replies - 16 through 24 (of 24 total)
  • The topic ‘Image Optimization Not Working’ is closed to new replies.