• Resolved tesmer

    (@uraniumhazee)


    I have a big problem so i hope you can help me.
    In this topic i will explain all the things so you can find where the problem is.

    I have a DEBIAN LEMP NGINX FastCGI Server and have a site in it.
    I Set it manually and fastcgi cache works without a problem but i can not use Cloudflare with this system because when i test the cache it always gives CF-Cache-Status: EXPIRED error.

    My plugins!
    I only use Autoptimize and Your Plugin WP Cloudflare Super PAge Cache
    And Enable 404 fallbacks enabld.
    I don’t use Nginx helpe i clear my cache with this command:
    rm -rf /usr/share/nginx/fastcgi_cache/*

    My nginx.conf

    user www-data;
    worker_processes auto;
    pid /run/nginx.pid;
    include /etc/nginx/modules-enabled/*.conf;
    
    events {
    	worker_connections 768;
    	# multi_accept on;
    }
    
    http {
    	# NGINX Cache path
    	fastcgi_cache_path /usr/share/nginx/fastcgi_cache levels=1:2 keys_zone=phpcache:100m max_size=10g inactive=60m use_temp_path=off;
    	fastcgi_cache_key "$scheme$request_method$host$request_uri";
    	##
    	# Basic Settings
    	##
    
    	sendfile on;
    	tcp_nopush on;
    	types_hash_max_size 2048;
    	# server_tokens off;
    
    	# server_names_hash_bucket_size 64;
    	# server_name_in_redirect off;
    
    	include /etc/nginx/mime.types;
    	default_type application/octet-stream;
    
    	##
    	# SSL Settings
    	##
    
    	ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
    	ssl_prefer_server_ciphers on;
    
    	##
    	# Logging Settings
    	##
    
    	access_log /var/log/nginx/access.log;
    	error_log /var/log/nginx/error.log;
    
    	##
    	# Gzip Settings
    	##
    
    	gzip on;
    	gzip_disable "msie6";
    	gzip_vary on;
    	gzip_proxied any;
    	gzip_comp_level 6;
    	gzip_buffers 16 8k;
    	gzip_http_version 1.1;
    	gzip_min_length 256;
    	gzip_types text/richtext text/plain text/css text/vcard text/x-script text/x-component text/x-java-source text/x-markdown text/vnd.rim.location.xloc text/vtt application/javascript application/x-javascript text/javascript text/js text/cache-manifest image/bmp image/x-icon image/vnd.microsoft.icon application/x-perl application/x-httpd-cgi text/xml application/geo+json application/atom+xml application/xml application/rdf+xml application/xml+rss application/vnd.api+json application/vnd.geo+json application/x-protobuf application/json multipart/bag multipart/mixed application/xhtml+xml font/opentype font/eot font/ttf font/otf font/x-woff image/svg+xml application/vnd.ms-fontobject application/ttf application/x-ttf application/x-font-ttf application/otf application/x-otf application/truetype application/opentype application/x-opentype application/font-woff application/eot application/font application/font-sfnt application/wasm application/javascript-binast application/manifest+json application/ld+json application/x-web-app-manifest+json text/x-cross-domain-policy;
    
    	##
    	# Virtual Host Configs
    	##
    
    	include /etc/nginx/conf.d/*.conf;
    	include /etc/nginx/sites-enabled/*;
    }
    
    #mail {
    #	# See sample authentication script at:
    #	# https://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
    #
    #	# auth_http localhost/auth.php;
    #	# pop3_capabilities "TOP" "USER";
    #	# imap_capabilities "IMAP4rev1" "UIDPLUS";
    #
    #	server {
    #		listen     localhost:110;
    #		protocol   pop3;
    #		proxy      on;
    #	}
    #
    #	server {
    #		listen     localhost:143;
    #		protocol   imap;
    #		proxy      on;
    #	}
    #}
    

    My server block site.conf :

    server {
       server_name wifisifrekirici.com www.wifisifrekirici.com;
       root /var/www/wifisifrekirici.com;
       index index.php index.html index.htm;
    
       client_max_body_size 30M;
    
    set $skip_cache 0;
    
    # POST requests and urls with a query string should always go to PHP
    if ($request_method = POST) {
        set $skip_cache 1;
    }
    if ($query_string != "") {
        set $skip_cache 1;
    }
    
    # Don't cache uris containing the following segments
    if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|^/feed/*|/tag/.*/feed/*|index.php|/.*sitemap.*\.(xml|xsl)") {
        set $skip_cache 1;
    }
    
    # Don't use the cache for logged in users or recent commenters
    if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
        set $skip_cache 1;
    }
    
    location / {
    		try_files $uri $uri/ /index.php?$args;
       }
    
    location ~ \.php$ {
          include /etc/nginx/fastcgi_params;
          fastcgi_pass unix:/run/php/php7.4-fpm.sock;
          fastcgi_index index.php;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          fastcgi_cache_bypass $skip_cache;
          fastcgi_no_cache $skip_cache;
          fastcgi_cache phpcache;
          fastcgi_cache_valid 200 301 302 60m;
          fastcgi_cache_use_stale error timeout updating invalid_header http_500 http_503;
          fastcgi_cache_min_uses 1;
          fastcgi_cache_lock on;
          add_header X-FastCGI-Cache $upstream_cache_status;
          fastcgi_connect_timeout 300s;
          fastcgi_read_timeout 300s;
          fastcgi_send_timeout 300s;
       }
    
    location = /favicon.ico { log_not_found off; access_log off; }
    location = /robots.txt { log_not_found off; access_log off; allow all; }
    location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
            expires max;
            log_not_found off;
    }
    
        listen 443 ssl; # managed by Certbot
        ssl_certificate /etc/letsencrypt/live/wifisifrekirici.com-0001/fullchain.pem; # managed by Certbot
        ssl_certificate_key /etc/letsencrypt/live/wifisifrekirici.com-0001/privkey.pem; # managed by Certbot
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
    
    }
    server {
        if ($host = www.wifisifrekirici.com) {
            return 301 https://$host$request_uri;
        } # managed by Certbot
    
        if ($host = wifisifrekirici.com) {
            return 301 https://$host$request_uri;
        } # managed by Certbot
    
       listen 80;
       server_name wifisifrekirici.com www.wifisifrekirici.com;
        return 404; # managed by Certbot
    
    }
    

    Cloudflare Settings!
    Browser Cache TTL = Respect Existing Headers
    Caching Level = Standart

    Network setting:
    Beside default settings i activated 2 setting
    0-RTT Connection Resumption ON
    gRPC ON

    Rules=
    https://wifisifrekirici.com/*
    Cache Level: Cache Everything
    Enabled
    ( I installed your plugin WP Cloudflare Super Page Cache so this rule is added automatically)

    WP Cloudflare Super Page Cache Settings:
    There is a strage thing.
    In default:
    Cloudflare Cache-Control max-age 31536000
    Browser Cache-Control max-age 60

    Cache tests
    I used Chrome Browser and 2 Cache test sites
    https://cache-checker.com/
    https://bigballi.com/blog/check-if-cloudflare-cache-is-working

    Bigballi Cache test results
    when i try Each time it gives below stats

    EXPIRED - https://wifisifrekirici.com (0.53s) BYPASS - https://wifisifrekirici.com/sitemap_index.xml (0.48s) EXPIRED - https://wifisifrekirici.com/wp-content/cache/autoptimize/css/autoptimize_33bd53d8668efabf3e6483fef0cdc38a.css (0.53s) EXPIRED - https://wifisifrekirici.com/wp-content/cache/autoptimize/js/autoptimize_356f5ef3ce9c0a1c7c5c975362898e07.js (0.57s) EXPIRED - https://wifisifrekirici.com/wp-content/plugins/autoptimize/classes/external/js/lazysizes.min.js?ao_version=2.9.2 (0.42s) EXPIRED - https://wifisifrekirici.com/wp-content/themes/kadence/assets/css/content.min.css?ver=1.1.6 (0.4s) EXPIRED - https://wifisifrekirici.com/wp-content/themes/kadence/assets/css/footer.min.css?ver=1.1.6 (0.41s) EXPIRED - https://wifisifrekirici.com/wp-content/themes/kadence/assets/css/header.min.css?ver=1.1.6 (0.39s) EXPIRED - https://wifisifrekirici.com/wp-content/uploads/cropped-favicon-180x180.png (0.4s) EXPIRED - https://wifisifrekirici.com/wp-content/uploads/cropped-favicon-192x192.png (0.43s) EXPIRED - https://wifisifrekirici.com/wp-content/uploads/cropped-favicon-32x32.png (0.4s) EXPIRED - https://wifisifrekirici.com/wp-content/uploads/logo.png (0.42s) EXPIRED - https://wifisifrekirici.com/wp-content/uploads/wifi-sifre-kirma.png (0.27s) EXPIRED - https://wifisifrekirici.com/wp-content/uploads/wps-pin-uretici.jpg (0.52s) EXPIRED - https://wifisifrekirici.com/wp-includes/js/jquery/jquery.min.js (0.52s) MISS - https://wifisifrekirici.com/wp-includes/wlwmanifest.xml (0.4s) EXPIRED - https://wifisifrekirici.com/wp-json/oembed/1.0/embed?url=https%3A%2F%2Fwifisifrekirici.com%2F (0.48s) EXPIRED - https://wifisifrekirici.com/wp-json/oembed/1.0/embed?url=https%3A%2F%2Fwifisifrekirici.com%2F&format=xml (0.46s) EXPIRED - https://wifisifrekirici.com/xmlrpc.php?rsd (0.46s) -Found at https://bigballi.com/blog/check-if-cloudflare-cache-is-working.

    Chrome Network First Test Main Page
    https://i.imgur.com/08JZO7C.png
    Chrome Network second Test Main Page
    https://i.imgur.com/F9AXkMD.png
    This is too strange that although i purge the cache from cloudflare and purge the nginx fastcgi cache with rm -rf /usr/share/nginx/fastcgi_cache/* fastcgi cache gives me to time hit one after another tests

    Putty test

    root@wifi:~# curl -I https://wifisifrekirici.com
    HTTP/2 200
    date: Mon, 18 Oct 2021 10:13:52 GMT
    content-type: text/html; charset=UTF-8
    vary: Accept-Encoding
    link: <https://wifisifrekirici.com/wp-json/>; rel="https://api.w.org/"
    link: <https://wifisifrekirici.com/wp-json/wp/v2/pages/2246>; rel="alternate"; type="application/json"
    link: <https://wifisifrekirici.com/>; rel=shortlink
    cache-control: s-maxage=31536000, max-age=60
    x-wp-cf-super-cache: cache
    x-wp-cf-super-cache-active: 1
    x-wp-cf-super-cache-cache-control: s-maxage=31536000, max-age=60
    x-wp-cf-super-cache-cookies-bypass: swfpc-feature-not-enabled
    x-fastcgi-cache: MISS
    cf-cache-status: HIT
    age: 24
    last-modified: Mon, 18 Oct 2021 10:13:28 GMT
    expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
    report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=l%2F6y5CIZlV1NXwZYVpv5MIn4j4pKhIaSPF77jmjSXjTB%2BbBdyqad%2FwiXW7iH7JTyLNt6%2BMLs6xSNOVcaDJGoxYegKz8KLKSnK%2BVuNc1awIqpYQxjvaIz0koFM9sfPNMwl%2BtT8tvxsKRal9D0qA%2BlAIu3"}],"group":"cf-nel","max_age":604800}
    nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
    server: cloudflare
    cf-ray: 6a00ff1d5fab6955-FRA
    alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400, h3-28=":443"; ma=86400, h3-27=":443"; ma=86400
    
    root@wifi:~#
    

    secon putty

    root@wifi:~# curl -I https://wifisifrekirici.com
    HTTP/2 200
    date: Mon, 18 Oct 2021 10:14:54 GMT
    content-type: text/html; charset=UTF-8
    vary: Accept-Encoding
    link: <https://wifisifrekirici.com/wp-json/>; rel="https://api.w.org/"
    link: <https://wifisifrekirici.com/wp-json/wp/v2/pages/2246>; rel="alternate"; type="application/json"
    link: <https://wifisifrekirici.com/>; rel=shortlink
    cache-control: s-maxage=31536000, max-age=60
    x-wp-cf-super-cache: cache
    x-wp-cf-super-cache-active: 1
    x-wp-cf-super-cache-cache-control: s-maxage=31536000, max-age=60
    x-wp-cf-super-cache-cookies-bypass: swfpc-feature-not-enabled
    x-fastcgi-cache: MISS
    cf-cache-status: HIT
    age: 86
    last-modified: Mon, 18 Oct 2021 10:13:28 GMT
    expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
    report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=TgnZsRKfzT%2FrN4YBDvQSIGNx5bOgXeFfu0yUAPOSUYZgGm7x3Kvd97gMEhyN%2BY1XcvY8t7wLN%2B%2BhMqWM%2BA%2BZwoS4i9HObjoRchBCvRFUkKlPdPPqhCiYPYCfkbewTL326C%2FADb7q8n3siPUc%2BH3ikesU"}],"group":"cf-nel","max_age":604800}
    nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
    server: cloudflare
    cf-ray: 6a01009bed104345-FRA
    alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400, h3-28=":443"; ma=86400, h3-27=":443"; ma=86400
    
    root@wifi:~#
    

    I don’t know where the problem is may be there is a problem at server conf
    On putty tests nginx cache works fine but cloudflare gives 2x hit information as well for the putty.
    On chrome tests nginx fastcgi tests gives 2x hit info, cloudflare gives expired error.

    This cache is not stable for me.
    Could you please help me where is the problem.

    Thanks for all

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor iSaumya

    (@isaumya)

    Hi,
    Have you installed this plugin? Cause as I am checking your site I am not seeing this plugin being active on your site. If the plugin is not installed please install the plugin and set it up with your CF API key.

    Make sure there is no other plugin that has Cloudflare integration on your site and trying to manipulate CF cache beside this plugin.

    Also share a screenshot of your CF dashboard > Page Rules section.

    Thread Starter tesmer

    (@uraniumhazee)

    @isaumya
    So sorry i had a issue about site.

    Could you please check again?
    This is too important for me?

    Here are the screenshots

    View post on imgur.com

    I did not change any settings in WP Cloudflare Super Page Cache plugin

    Thanks for your help

    • This reply was modified 3 years, 1 month ago by tesmer.
    Thread Starter tesmer

    (@uraniumhazee)

    @isaumya

    Hi again. Today i found something.
    I think Wp Super Cache works great but this time fastcgi cache not working.

    How i know this.

    First of all i visited a page first time
    cf-cache-status: MISS
    x-wp-cf-super-cache: cache
    x-wp-cf-super-cache-active: 1
    x-fastcgi-cache: MISS

    second test

    cf-cache-status: HIT
    x-wp-cf-super-cache: cache
    x-wp-cf-super-cache-active: 1
    x-fastcgi-cache: MISS

    WP Clouddlare super cache works
    But since adding rule cache everything, x-fastcgi-cache: always MISS WHY? I refreshed same page 3-4 times but always MISS It seems fstcgi cache not working now

    how do i get fastcgi cache to work at the same time?
    Could you please look my conf files and should i edit something there?

    Thanks

    Plugin Contributor iSaumya

    (@isaumya)

    Hi,
    as I can see the Cloudflare cache is working fine on your site: https://i.imgur.com/Wsxx3qD.png

    Now coming to why fast CGI cache is MISS while CF Cache is HIT is because when you are utilizing CF cache you mostly don’t need fastcgi or any other cache.

    So, when you purge all cache (fastcgi & CF) and then request a page as a non logghedin user. During the first request as the page HTML is not cached either is fastcgi or CF, the origin server executes all the PHP code and generate the HTML content of the page.
    Note: Till now both fastcgi & CF cache is MISS

    After that it send the output to the user. During this time (after receiving the 1st request) the CF CDN server cache that HTML page. Now when you send another request for the same page, it is intercepted by CD CDN and served from CF server without the request even hitting your origin server so your fastcgi cache didn’t get a time to update it’s system and remains MISS.

    Now if the cache gets expired in CF and the request again reaches to the origin server at this time fastcgi cache will become HIT and the cycle will continue.

    P.S: You should also check this thread: https://www.ads-software.com/support/topic/preloading-the-cache-per-edge-server/

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘CF-Cache-Status: EXPIRED’ is closed to new replies.