Title: Image Optimization Not Working
Last modified: June 11, 2020

---

# Image Optimization Not Working

 *  Resolved [lechon](https://wordpress.org/support/users/lechon/)
 * (@lechon)
 * [6 years ago](https://wordpress.org/support/topic/image-optimization-not-working-3/)
 * 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/](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 15 replies - 1 through 15 (of 24 total)

1 [2](https://wordpress.org/support/topic/image-optimization-not-working-3/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/image-optimization-not-working-3/page/2/?output_format=md)

 *  [LucasRolff](https://wordpress.org/support/users/lucasrolff/)
 * (@lucasrolff)
 * [6 years ago](https://wordpress.org/support/topic/image-optimization-not-working-3/#post-12969508)
 * v3.x of the plugin uses WordPress’ Rest API (/wp-json/litespeed/v1/notify_img
   to be specific) to do callbacks.
 * Your site seems to be blocking this callback:
 * `{"code":"rest_not_logged_in","message":"You do not have sufficient permission
   to access this endpoint. Access to REST API requests is restricted.","data":{"
   status":401}}`
 * If you have anything that restricts access to the REST API, then you have to 
   allow `/wp-json/litespeed` calls.
 *  Thread Starter [lechon](https://wordpress.org/support/users/lechon/)
 * (@lechon)
 * [6 years ago](https://wordpress.org/support/topic/image-optimization-not-working-3/#post-12971502)
 * [@lucasrolff](https://wordpress.org/support/users/lucasrolff/)
 * Thanks for the feedback.
 * For security reasons we have the following code on our site:
 * //Restricts REST API Access
    add_filter( ‘rest_authentication_errors’, function(
   $result ) { if ( ! empty( $result ) ) { return $result; } 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 ) )
 * Our site gets viciously attack on a daily basis via REST API.
 * Under LiteSpeed V 2.9 Restricting API was not at issue at all, including image
   optimization.
 * Is there a way to “Whitelist” the REST API calls from LiteSpeed That we can implement
   in our code shown above?
 * Giving everyone access to REST API is not a solution for us.
 * Best regards,
 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [6 years ago](https://wordpress.org/support/topic/image-optimization-not-working-3/#post-12973771)
 * Hi,
 * Perhaps this [topic](https://wordpress.org/support/topic/restrict-rest-api-access-2/)
   helps ,you can get our IPs [here](https://www.quic.cloud/ips)
 * Best regards,
 *  Thread Starter [lechon](https://wordpress.org/support/users/lechon/)
 * (@lechon)
 * [6 years ago](https://wordpress.org/support/topic/image-optimization-not-working-3/#post-12973901)
 * [@qtwrk](https://wordpress.org/support/users/qtwrk/)
 * Thanks for the information. Let me look into this and see how it goes.
 * Regarding your IP list. Do I need to use every single IP? the reason I am asking
   is because I ran your IPs trough an IP abuse database and it flagged some of 
   the IPs.
 * [https://www.abuseipdb.com/check/185.149.235.173](https://www.abuseipdb.com/check/185.149.235.173)
   
   [https://www.abuseipdb.com/check/199.59.247.242](https://www.abuseipdb.com/check/199.59.247.242)
   [https://www.abuseipdb.com/check/94.75.232.90](https://www.abuseipdb.com/check/94.75.232.90)
   [https://www.abuseipdb.com/check/212.162.151.34](https://www.abuseipdb.com/check/212.162.151.34)
   [https://www.abuseipdb.com/check/18.188.223.222](https://www.abuseipdb.com/check/18.188.223.222)
 * Best regards,
 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [6 years ago](https://wordpress.org/support/topic/image-optimization-not-working-3/#post-12976803)
 * Hi,
 * That might be the “good thing ” done by previous owner , as you know , our nodes
   are hosted on DO or AWS and some are from donation of providers, many people 
   might have used that IP before we do and leave some bad record.
 * Yes, you should whitelist all of them.
 * Best regards,
 *  Thread Starter [lechon](https://wordpress.org/support/users/lechon/)
 * (@lechon)
 * [6 years ago](https://wordpress.org/support/topic/image-optimization-not-working-3/#post-12977132)
 * [@qtwrk](https://wordpress.org/support/users/qtwrk/)
 * Thanks for the explanation.
 * Let me give it a try and see how it goes.
 * Best regards
 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [6 years ago](https://wordpress.org/support/topic/image-optimization-not-working-3/#post-12977845)
 * Hi,
 * Please let us know if image opt works now or not
 * Best regards,
 *  Thread Starter [lechon](https://wordpress.org/support/users/lechon/)
 * (@lechon)
 * [6 years ago](https://wordpress.org/support/topic/image-optimization-not-working-3/#post-12979349)
 * I am still testing, I have not managed to work yet.
 * If we can’t get it to work, we might give up on the image optimization. The Security
   of REST API is too important for us.
 * Best regards,
 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [6 years ago](https://wordpress.org/support/topic/image-optimization-not-working-3/#post-12979354)
 * Hi,
 * They are many ways to secure it , something like
 *     ```
       RewriteCond %{REMOTE_ADDR} ....our IPs....
       RewriteCond %{REQUEST_URI} wp-json
       RewriteRule .* - [F]
       ```
   
 * if it requests wp-json and doesn’t come from designated IP , 403s it.
 * I am sure there are also some plugins or code snippet to get same effect.
 * Best regards,
 *  Thread Starter [lechon](https://wordpress.org/support/users/lechon/)
 * (@lechon)
 * [6 years ago](https://wordpress.org/support/topic/image-optimization-not-working-3/#post-12981333)
 * [@qtwrk](https://wordpress.org/support/users/qtwrk/)
 * Hello,
 * We were able to make it work using the format suggested here:
    [https://wordpress.org/support/topic/restrict-rest-api-access-2/](https://wordpress.org/support/topic/restrict-rest-api-access-2/)
 * But in the process it breaks other plugins that uses REST API in a different 
   way than LiteSpeed does, like for example the plugin “Redirection”, it completely
   breaks it.
 * So we are back to square 1. We don’t have image optimization.
 * We were so happy with version 2.9 of this plugin everything worked from the get
   go.
    You would think that with the enterprise version of the LiteSpeed Server
   that we have these REST API calls could run in the background as a core function,
   but I guess this is not how it all works.
 * Best regards,
 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [5 years, 12 months ago](https://wordpress.org/support/topic/image-optimization-not-working-3/#post-12981953)
 * Hi,
 * So when you use
 *     ```
       //Restricts REST API Access
       add_filter( ‘rest_authentication_errors’, function( $result ) {
       if ( ! empty( $result ) ) {
       return $result;
       }
       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 ) )
       ```
   
 * your redirection plugins works without problem ?
 * Best regards,
 *  Thread Starter [lechon](https://wordpress.org/support/users/lechon/)
 * (@lechon)
 * [5 years, 12 months ago](https://wordpress.org/support/topic/image-optimization-not-working-3/#post-12982019)
 * [@qtwrk](https://wordpress.org/support/users/qtwrk/)
 * Hi,
 * That is correct. Redirection plugin has been working for the past 2 years with
   the code above.
 * Best regards,
 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [5 years, 12 months ago](https://wordpress.org/support/topic/image-optimization-not-working-3/#post-12988509)
 * Hi,
 * For your situation , we added a new API.
 * Please upgrade to v3.2.3 RC2 or wait for new release, and then change your code
 * from
 * `if ( ! is_user_logged_in() ) {`
 * to
 * `if ( ! is_user_logged_in() && ( ! defined( 'LSCWP_V' ) || ! apply_filters( '
   litespeed_is_from_cloud', false ) ) ) {`
 * this will add a check to incoming IP , if it is not from our nodes , it will 
   be 401 by your following code.
 * Best regards,
 *  Thread Starter [lechon](https://wordpress.org/support/users/lechon/)
 * (@lechon)
 * [5 years, 12 months ago](https://wordpress.org/support/topic/image-optimization-not-working-3/#post-12989845)
 * [@qtwrk](https://wordpress.org/support/users/qtwrk/)
 * Hello,
 * Thanks for the information and feedback.
 * I am going to wait for the new release just to make things simple on my end and
   I will make sure to add the new modified code that you have suggested here after
   the update
 * Many thanks for developing a solution to this.
 * Best regards,
 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/image-optimization-not-working-3/#post-13006805)
 * Hi,
 * New version has been released
 * Best regards,

Viewing 15 replies - 1 through 15 (of 24 total)

1 [2](https://wordpress.org/support/topic/image-optimization-not-working-3/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/image-optimization-not-working-3/page/2/?output_format=md)

The topic ‘Image Optimization Not Working’ is closed to new replies.

 * ![](https://ps.w.org/litespeed-cache/assets/icon-256x256.png?rev=2554181)
 * [LiteSpeed Cache](https://wordpress.org/plugins/litespeed-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/litespeed-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/litespeed-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/litespeed-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/litespeed-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/litespeed-cache/reviews/)

 * 24 replies
 * 3 participants
 * Last reply from: [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * Last activity: [5 years, 11 months ago](https://wordpress.org/support/topic/image-optimization-not-working-3/page/2/#post-13027137)
 * Status: resolved