• Resolved mischa87

    (@mischa87)


    Hi there,

    thanks for providing this plugin that I really would like to use. Unfortunately, I cannot get it to work, since I get “An error occurred while connecting to REST API. Please try again. ” when trying to convert the images.

    The issue seems to be caused by a 404 when accessing “https://blog.bikingglobetrotter.de/index.php?rest_route=/webp-converter/v1/paths?_wpnonce=f5fe180c18”

    Do you have an explanation for that? I tried to debug the issue further, but no debug log file is written after activating WP_DEBUG and WP_DEBUG_LOG.
    Rest API seems to accessible in general. (checked accessing ?rest_route= )

    The server uses wordpress:5.6.0 docker image running behind an NGINX SSL proxy (https://hub.docker.com/r/jwilder/nginx-proxy)

    Any help is appreciated.

    Questions from FAQ:
    1. Do you have any error on the plugin settings page? Enter error codes. Have you consulted your server administrator or developer?
    As said before, “An error occurred while connecting to REST API. Please try again. ” when trying to convert the image.

    2. URL of your website. If your site is not publicly available, add it to test environment.
    see above

    3. Configuration of your server (link to it can be found on the settings page of plugin in the section “We are waiting for your message”) – please take a screenshot of the ENTIRE page and send it to me.
    https://ibb.co/F5XX0my

    4. Settings of plugin – please take a screenshot of the ENTIRE page and send it to me.
    https://ibb.co/c1xP7Qc
    https://ibb.co/1TC12rh

    5. Do you use CDN? If so, please see the question “Does the plugin support CDN?” in plugin FAQ.
    No

    6. Please do the test, which is described in the FAQ in question How to check if plugin works?. Please send a screenshot of Devtools with test results.
    Well, since no image has been converted, chrome also don’t lists any webp file.

    7. Content of your .htaccess files from directories /wp-content, /wp-content/uploads and /wp-content/uploads-webpc (pasting the code using the CODE shortcode in the editor).
    /wpcontent/.htaccess

    
    # BEGIN WebP Converter
    # ! --- DO NOT EDIT PREVIOUS LINE --- !
    <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteCond %{HTTP_ACCEPT} image/webp
      RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpg.webp -f
      RewriteCond %{HTTP_HOST}@@%{HTTP_REFERER} ^([^@]*)@@https?://\1/.*
      RewriteRule (.+)\.jpg$ /wp-content/uploads-webpc/$1.jpg.webp [NC,T=image/webp,E=cache-control:no-cache,L]
      RewriteCond %{HTTP_ACCEPT} image/webp
      RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpeg.webp -f
      RewriteCond %{HTTP_HOST}@@%{HTTP_REFERER} ^([^@]*)@@https?://\1/.*
      RewriteRule (.+)\.jpeg$ /wp-content/uploads-webpc/$1.jpeg.webp [NC,T=image/webp,E=cache-control:no-cache,L]
      RewriteCond %{HTTP_ACCEPT} image/webp
      RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.png.webp -f
      RewriteCond %{HTTP_HOST}@@%{HTTP_REFERER} ^([^@]*)@@https?://\1/.*
      RewriteRule (.+)\.png$ /wp-content/uploads-webpc/$1.png.webp [NC,T=image/webp,E=cache-control:no-cache,L]
    </IfModule>
    # ! --- DO NOT EDIT NEXT LINE --- !
    # END WebP Converter

    /wpcontent/uploads/.htaccess

    
    # BEGIN WebP Converter
    # ! --- DO NOT EDIT PREVIOUS LINE --- !
    <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteCond %{HTTP_ACCEPT} image/webp
      RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/uploads/$1.jpg.webp -f
      RewriteCond %{HTTP_HOST}@@%{HTTP_REFERER} ^([^@]*)@@https?://\1/.*
      RewriteRule (.+)\.jpg$ /wp-content/uploads-webpc/uploads/$1.jpg.webp [NC,T=image/webp,E=cache-control:no-cache,L]
      RewriteCond %{HTTP_ACCEPT} image/webp
      RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/uploads/$1.jpeg.webp -f
      RewriteCond %{HTTP_HOST}@@%{HTTP_REFERER} ^([^@]*)@@https?://\1/.*
      RewriteRule (.+)\.jpeg$ /wp-content/uploads-webpc/uploads/$1.jpeg.webp [NC,T=image/webp,E=cache-control:no-cache,L]
      RewriteCond %{HTTP_ACCEPT} image/webp
      RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/uploads/$1.png.webp -f
      RewriteCond %{HTTP_HOST}@@%{HTTP_REFERER} ^([^@]*)@@https?://\1/.*
      RewriteRule (.+)\.png$ /wp-content/uploads-webpc/uploads/$1.png.webp [NC,T=image/webp,E=cache-control:no-cache,L]
    </IfModule>
    # ! --- DO NOT EDIT NEXT LINE --- !
    # END WebP Converter
    

    /wp-content/uploads-webpc

    
    # BEGIN WebP Converter
    # ! --- DO NOT EDIT PREVIOUS LINE --- !
    <IfModule mod_mime.c>
      AddType image/webp .webp
    </IfModule>
    <IfModule mod_expires.c>
      ExpiresActive On
      ExpiresByType image/webp "access plus 1 year"
    </IfModule>
    # ! --- DO NOT EDIT NEXT LINE --- !
    # END WebP Converter

    `

    8. Do you use any plugin filters or actions from this FAQ? If so, list them all.
    I don’t know what you mean with that.

    9. What plugin version are you using? If it is not the latest then update and check everything again.
    Latest

    10. Used WordPress version.
    5.6.0 (Docker image)

    11. A list of all the plugins you use. Have you tried checking the plugin operation by turning off all others and activating the default theme? If not, please try whenever possible. This is very important because other plugins or themes can cause problems. Therefore, we recommend disabling all necessary plugins and enabling the default theme.
    List of installed plugins: https://ibb.co/cgyjnFj
    I tried to disable all others, but the behavior is the same.

    Best regards
    Michael

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Hi @mischa87,

    Thank you for your message.

    The path to the REST API in your WordPress installation is custom. Can you say more about it? The default is /wp-json.

    Thread Starter mischa87

    (@mischa87)

    Hi @mateuszgbiorczyk,

    Thanks for your quick help. Not really… Although I am a software developer, I have no technical insights of WordPress and the instance that I am using.
    I only know that the instance is quite old (so several updates have already been applied, plugins added and removed) and was moved to the docker container recently.
    Do you have any idea, what could have modified it and how to check that?

    Regards
    Michael

    Thread Starter mischa87

    (@mischa87)

    Hi @mateuszgbiorczyk,

    Thanks for the hint. I got it fixed and it works now. New REST API request uses
    …./wp-json/webp-converter/v1/paths?_wpnonce=9d0d584b7b

    I activated “Pretty Permalinks” in the settings. According to WP REST API Documentation, this modifies the URL name:

    On sites without pretty permalinks, the route is instead added to the URL as the rest_route parameter. For the above example, the full URL would then be http://example.com/?rest_route=/wp/v2/posts/123

    Not sure, whether this is a bug in your plugin or in my wordpress instance.
    Thanks again for your help.

    Best regards
    Michael

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘404 when accessing REST API’ is closed to new replies.