• Resolved captainproton

    (@captainproton)


    I have been using Webp-converter-for-media for a few months without issue.

    I check for plugin updates daily and this morning I updated to version 1.4.2. The site is working fine but I cannot use the ‘Regenerate’ function.

    I have a Server Configuration Error

    Your server uses the cache for redirects. The rules from .htaccess file or from Nginx configuration are not executed every time when the image is loaded, but the last redirect from cache is performed. With each request to image, your server should execute the rules from .htaccess file or from Nginx configuration. Now it only does this the first time and then uses cache. This means that if your server redirected image to WebP format the first time, it does so on every request. It should check the rules from .htaccess file or from Nginx configuration each time during request to image and redirect only when the conditions are met. Disable server cache for redirects. Please contact your server administrator.

    _____________________________________

    Nothing has changed in the server configuration. It has remained constant for at least the last month. The plugin has been working and the regenerate function has always worked.

    I have use a reverse proxy setup with Nginx on the front end and Apache on the back end. Both are on separate machines.

    All .htaccess files are as suggested in another thread with the same error message. Their fix eventually turned out to be an issue with a proxy and name server changes. That doesn’t apply to me as I have my own name servers and all servers are physically located here with me. No proxies, except for Nginx.

    I also took out the caching directives relating to webp. Still no change.

    I eventually opted for a temporary fix and disabled the error checking, related to caching, within the webp code.

    That solved the problem. Regeneration completed successfully and the site is working fine after clearing the Nginx cache.

    It would seem to me there is something wacky going on with the plugin. As I’ve said, everything has been working for months and the server config has been unchanged. The only difference was the plugin update to version 1.4.2.

    I have half a dozen sites running the plugin and don’t look forward to my code mod for each of them.

    Any help would be appreciated.

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

    (@mateuszgbiorczyk)

    Hi @captainproton,

    Thanks for your message.

    Please read the error message again. It is impossible to better explain the issue. The message contains all the information to present the problem.

    Unfortunately, I am not able to help you any more. This is a problem with your server configuration. The plugin detects such problems and informs the user about it.

    Please contact your server administrator.

    If you have this problem now, it means that it was occurring all the time, but you were not aware that something was not working properly.

    Thread Starter captainproton

    (@captainproton)

    Is there a valid reason why the “Regenerate” button is disabled when this error is shown. It seems when the error is bypassed regeneration works perfectly, the site works perfectly and all redirects work as expected.

    Even with no form of caching the error continues. All http headers suggested everything is fresh with no-cache. Server response also says no-cache.

    I’d be interested to know what error is being picked up that no other plugin or site, using wordpress, joomla, html, can detect.

    I’m sorry if my attitude appears a little off but I’m trying to understand what the problem really is.

    Thanks for you help.

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @captainproton, please contact me via e-mail – mateusz[at@]gbiorczyk[dot.]pl. I will try to diagnose your problem individually.

    I also facing the same issue.

    
    Server configuration error
    
    Your server uses the cache for redirects. The rules from .htaccess file or from Nginx configuration are not executed every time when the image is loaded, but the last redirect from cache is performed. With each request to image, your server should execute the rules from .htaccess file or from Nginx configuration. Now it only does this the first time and then uses cache. This means that if your server redirected image to WebP format the first time, it does so on every request. It should check the rules from .htaccess file or from Nginx configuration each time during request to image and redirect only when the conditions are met. Disable server cache for redirects. Please contact your server administrator.
    

    Regenerate Button Disabled

    Thread Starter captainproton

    (@captainproton)

    @mateuszgbiorczyk Thanks for you reply and again I apologise if my previous reply wasn’t respectful at all.

    I also bypassed the Nginx Reverse Proxy and went straight to Apache and the same issue continues. All .htaccess files are correct as far as I can tell.

    I have temporarily resolved the issue by bypassing the code which throws this particular error. I’ve done this for all my sites.

    The ‘Regenerate’ button is re-enabled and works perfectly. I have tested all sites with and without caching with no issues.

    Given that this error message appears minor then perhaps an option to ignore it rather than if effectively being fatal. By fatal I mean we cannot regenerate.

    I will email you directly in the next day or so.

    Other than the issue I’m having I consider it to be an excellent plugin and it works as advertised. ??

    Same problem. Rather urgent for me

    @captainproton Can you provide what you snipped please?

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @captainproton, @awkath and @deepvoice What is your Nginx configuration for the plugin? Can you pass her on? Is it the same as the FAQ??

    Thread Starter captainproton

    (@captainproton)

    @deepvoice Sorry for not getting back to you. I’ve been out of town.

    I modified /wp-content/plugins/webp-converter-for-media/app/Settings/Errors.php

    Around line 79 I commented out the following;

    } else if ($this->ifRedirectsAreCached() === true) {
            $errors[] = 'rewrites_cached';
          } 

    It now looks like this;

    } /** else if ($this->ifRedirectsAreCached() === true) {
            $errors[] = 'rewrites_cached';
          } **/

    I should point out that bypassing error checking is never a good idea and this is a temporary fix allowing you to regenerate.

    Thread Starter captainproton

    (@captainproton)

    @mateuszgbiorczyk Sorry, I’ve been out of town. I will send a copy of my Nginx config when I get home later. Sorry to hold you up.

    Thread Starter captainproton

    (@captainproton)

    @mateuszgbiorczyk

    I have resolved the issue by adding the following;

    # Don't cache Webp
    
          if ($request_uri ~* "/*.webp") {
            set $do_not_cache 1;
            set $skip_reason "WEBP";
            set $bypass 1;
            }

    My Nginx and Apache were exactly as the FAQ suggested, including .htaccess.

    I did need to make one minor change with the try_files within the server block.

    try_files /wp-content/uploads-webpc/$path.$ext.webp $uri =404;
    
    became 
    
    proxy_pass https://apache_backend;

    I have a few physical server boxes here. Nginx is machine with apache on another. Nginx is used only for caching apache.

    The problem I have with bypassing the cache is the passing requests for images back to apache all the time rather than Nginx caching them. All sites are cached in a ram-drive. The apache machine processes php and other stuff and Nginx holds it all in memory. There is no disk activity at all when serving pages & images. So, bypassing caching for webp is a bit of a problem.

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @captainproton, that’s great information. I am very happy. Tell me please, does this apply only to your server or can it apply to others?

    What can I do to help other users in the future?

    Thread Starter captainproton

    (@captainproton)

    Hey there @mateuszgbiorczyk

    Thanks for your help.

    Not sure if this would apply to others or not. Perhaps it would if they have Nginx as a reverse proxy to an Apache back end.

    My configuration is based on many examples of Nginx reverse proxy techniques. The major difference is all pages are served out of ram rather than on disk.

    In case it is useful for others, below is the entire wordpress.conf which I include for my WordPress sites. Don’t take this as the perfect setup because it could do with improvement. It’s an ongoing thing.

    # CACHE CONFIGURATION for WordPress
    
    # define nginx variables
    
    	set $do_not_cache 0;
    	set $skip_reason "";
    	set $bypass 0;
      
    # Don't cache URIs containing the following segments
    
    	if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|sitemap(_index)?.xml|wp-cron") {
    	set $do_not_cache 1;
    	set $skip_reason URI;
    	set $bypass 1; 
    	}
    
    # Don't cache people signing up
    
    	if ($request_uri ~* "/join/|/wp-login.php?action=register|/wp-login.php?") {
    	set $do_not_cache 1;
    	set $skip_reason URI;
    	set $bypass 1;
    	}
    
    	if ($request_method = POST) {
    	set $do_not_cache 1;
    	set $skip_reason "POST";
    	set $bypass 1;
    	}   
    
    # skip caching WordPress cookies
    
    	if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wordpress_(?!test_cookie)|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
    	set $do_not_cache 1;
    	set $skip_reason "Cookie Type";
    	set $bypass 1;
    	}
      
    # Don't cache URIs for wordpress preview
    
    	if ($request_uri ~* "preview=true") {
    	set $do_not_cache 1;
    	set $skip_reason "PREVIEW";
    	set $bypass 1;
    	}
    
    # Don't cache Webp
    
          if ($request_uri ~* "/*.webp") {
            set $do_not_cache 1;
            set $skip_reason "WEBP";
            set $bypass 1;
            }
    
    # CACHE CONFIGURATION for WordPress - END
    
    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @captainproton, this part solves the cache problem? Does it work for all servers or are the variables $do_not_cache, $skip_reason, and $bypass individual for you?

    if ($request_uri ~* "/*.webp") {
      set $do_not_cache 1;
      set $skip_reason "WEBP";
      set $bypass 1;
    }

    Thank you very much for your commitment.

    Thread Starter captainproton

    (@captainproton)

    @mateuszgbiorczyk Yes, the $do_not_cache, $skip_reason and $bypass are variables. $skip_reason is nothing more than a string used in response headers and isn’t required.

    I originally (12 months ago) set up my servers loosely based on this tutorial; https://www.ryadel.com/en/nginx-reverse-proxy-cache-wordpress-apache-iis/

    When those variables set to 0 the request is retrieved from cache, when set to 1 it is served by Apache.

    It will only work for servers using Nginx as a reverse proxy. If they are using Nginx as their main http server then it would probably fail. I’m not an expert and really can’t offer a firm solution, but it worked for me.

    Also, bypassing the cache to serve images defeats the purpose of a cache and impacts performance. For me this is a temporary workaround.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘Regenerate not working – Server Configuration Error’ is closed to new replies.