• Resolved ArakaTech

    (@arakatech)


    Hello,

    I have the problem it said: Server configuration error ” Error codes: rewrites_cached ”

    here the notification:

    ‘`Server configuration error
    Your server uses the cache for HTTP requests. 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.

    In this case, please contact your server administrator.

    Error codes: rewrites_cached` ”

    I am using Nginx and Cloudflare SSL.

    on other site the configuration work fine if the Cloudflare SSL not activate/pause proxy on Cloudflare.

    how to resolve the problem?? if i am still using Cloudflare SSL.

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

    (@mateuszgbiorczyk)

    Hello @arakatech,

    Thanks for your message.

    The problem here, in my opinion, is not Cloudflare, but Nginx. This is Nginx with .htaccess support?

    Can you check if you have any rules (location {}) in your Nginx configuration for jpg, jpeg, png, gif and webp files?

    Best,
    Mateusz

    Thread Starter ArakaTech

    (@arakatech)

    Hello @mateuszgbiorczyk

    The nginx not support .htaccess i think. no panel used here.

    and any rules configuration according to the plugin is placed correctly like in the FAQ-Configuration for Nginx:

    i put rule like below:

    server {

    # BEGIN Converter for Media
    set $ext_avif ".avif";
    if ($http_accept !~* "image/avif") {
        set $ext_avif "";
    }
    
    set $ext_webp ".webp";
    if ($http_accept !~* "image/webp") {
        set $ext_webp "";
    }
    
    location ~ /wp-content/(?<path>.+)\.(?<ext>jpe?g|png|gif|webp)$ {
        add_header Vary Accept;
        expires 365d;
        try_files
            /wp-content/uploads-webpc/$path.$ext$ext_avif
            /wp-content/uploads-webpc/$path.$ext$ext_webp
            $uri =404;
    }
    # END Converter for Media

    and the rule for MIME Types have been checked also.
    using /etc/nginx/mime.types

    image/webp webp;

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @arakatech I understand you. You probably have some extra rules for image files in the rest of the Nginx rules, and they cause the Nginx Cache for those files.

    Thread Starter ArakaTech

    (@arakatech)

    Hello @mateuszgbiorczyk

    Can you show me the example what you mean on extra rules for image files?

    by the way, how to resolve the problem ?? Sorry, you haven’t provided a solution yet

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @arakatech Please send me the contents of the entire Nginx configuration file. Then I’ll tell you what’s going on.

    Thread Starter ArakaTech

    (@arakatech)

    Here the entire nginx conf;

    server {
    
    		# BEGIN Converter for Media
    		set $ext_avif ".avif";
    		if ($http_accept !~* "image/avif") {
    		set $ext_avif "";
    		}
    
    		set $ext_webp ".webp";
    		if ($http_accept !~* "image/webp") {
    			set $ext_webp "";
    		}
    
    		location ~ /wp-content/(?<path>.+)\.(?<ext>jpe?g|png|gif|webp)$ {
    			add_header Vary Accept;
    			expires 365d;
    			try_files
            /wp-content/uploads-webpc/$path.$ext$ext_avif
            /wp-content/uploads-webpc/$path.$ext$ext_webp
            $uri =404;
    		}
    		# END Converter for Media
    		
    		listen 80;
            listen 443 ssl http2;
            ssl_certificate /etc/ssl/mydomain.com/mydomain.com.crt;
            ssl_certificate_key /etc/ssl/mydomain.com/mydomain.com.key;
            root /var/www/html/mydomain.com;
            index index.php index.html index.htm;
            error_log /var/log/nginx/mydomain.com.error.log;
            server_name mydomain.com www.mydomain.com;
            location / {
    
                    try_files $uri $uri/ /index.php?$args;
            }
            if ($http_user_agent ~* (MJ12bot|SemrushBot|GrapeshotCrawler|BLEXBot|AhrefsBot|DotBot) ) { return 301 http://127.0.0.1/; }
            location ~* /(?:uploads|files)/.*\.(asp|bat|cgi|htm|html|ico|js|jsp|md|php|pl|py|sh|shtml|swf|twig|txt|yaml|yml|zip|gz|tar|bzip2|7z)$ { deny all; }
            location ~ \.php$ {
                    fastcgi_split_path_info ^(.+\.php)(/.+)$;
                    fastcgi_pass unix:/run/php/php7.4-mydomain.com-fpm.sock;
                    fastcgi_index index.php;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    include fastcgi_params;
            }
            location = /wp-login.php {
                    limit_req zone=limit burst=1 nodelay;
                    limit_req_status 429;
                    fastcgi_pass unix:/run/php/php7.4-mydomain.com-fpm.sock;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    include fastcgi_params;
            }
            location = /favicon.ico {
                    log_not_found off;
                    access_log off;
            }
            location = /robots.txt {
                    try_files $uri $uri/ /index.php?$args;
                    allow all;
                    log_not_found off;
                    access_log off;
            }
            location ~* \.(jpg|jpeg|png|gif|ico|css|js|eot|ttf|otf|woff|svg)$ {
                    expires 365d;
            }
    
                   include fastcgi_params;
            }
            location = /favicon.ico {
                    log_not_found off;
                    access_log off;
            }
            location = /robots.txt {
                    try_files $uri $uri/ /index.php?$args;
                    allow all;
                    log_not_found off;
                    access_log off;
            }
            location ~* \.(jpg|jpeg|png|gif|ico|css|js|eot|ttf|otf|woff|svg)$ {
                    expires 365d;
            }
            location ~ /\.ht {
                    deny all;
            }
            location ~ /\.us {
                    deny all;
            }
            location = /xmlrpc.php {
                    return 403;
            }
            rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
            rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
    
    }

    thats all.
    so how to fix Server configuration error ” Error codes: rewrites_cached “??

    thanks

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @arakatech Please note this code:

    location ~* \.(jpg|jpeg|png|gif|ico|css|js|eot|ttf|otf|woff|svg)$ {
      expires 365d;
    }

    Remove the jpg, jpeg, png, gif formats from there. And check again.

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

The topic ‘Server configuration error ” Error codes: rewrites_cached “’ is closed to new replies.