Score:0

How to skip Fastcgi Cache on Homepage?

in flag

I am running a WordPress website with Nginx.

However, due to compatibility issues with certain plugins, the login function does not work only on the homepage when fastcgi is activated.

So I want to disable fastcgi cache only on the homepage.

I have already set skip_cache as shown below,

        set $skip_cache 0;

        if ($request_method = POST) {
                set $skip_cache 1;
               set $skip_reason "POST";

        }
        if ($query_string != "") {
                set $skip_cache 1;
               set $skip_reason "QUERY_STRING";

        }
        if ( $cookie_woocommerce_items_in_cart = "1" ){ 
        set $skip_cache 1; 
       set $skip_reason WP_WooCommerce;

        } 
        if ( $cookie_woocommerce_cart_hash = "1" ){ 
        set $skip_cache 1; 
       set $skip_reason WP_WooCommerce;

        } 
        if ( $cookie_wp_woocommerce_session_[a-z0-9] = "1" ){ 
        set $skip_cache 1; 
           set $skip_reason WP_WooCommerce;
        } 
        if ( $cookie_wp_automatewoo_visitor_[a-z0-9] = "1" ){ 
        set $skip_cache 1; 
           set $skip_reason automatewoo;
        } 
        if ( $cookie_wp_automatewoo_session_started = "1" ){ 
        set $skip_cache 1; 
           set $skip_reason automatewoo;
        } 
        
    # WooCommerce-specific cache skip rules
    if ($request_uri ~* "/store.*|/cart.*|/my-account.*|/checkout.*|/addons.*") {
    set $skip_cache 1;
       set $skip_reason WP_WooCommerce;
    }

    if ( $arg_add-to-cart != "" ) { 
    set $skip_cache 1; 
       set $skip_reason add-to-cart;
    }
    if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wp_automatewoo_session_started|wp_automatewoo_visitor_[a-z0-9]|arlsf_c|wp_automatewoo_[a-z0-9]|yith_wcwl_products|wordpress_no_cache|wordpress_logged_in|woocommerce_items_in_cart|woocommerce_cart_hash|tinv_wishlistkey") {
            set $skip_cache 1;
           set $skip_reason cookie;
    }
    
    if ($request_uri ~* "(/thskan/|/my-account/|pum-[a-z0-9]|pum_[a-z0-9]|/checkout/|/cart/|/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
            set $skip_cache 1;
           set $skip_reason uri;

    }

    location ~ [^/]\.php(/|$) {
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        if (!-f $document_root$fastcgi_script_name) {
            return 404;
        }

        fastcgi_read_timeout 300;
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
        fastcgi_index index.php;
        fastcgi_buffers 64 16k; # default 8 4k
 
        #이 아래는 fastcgi 추가로 입력한것.
        fastcgi_buffer_size 32k;
        
        fastcgi_cache_bypass $skip_cache;
        fastcgi_no_cache $skip_cache;
        fastcgi_cache seoartgallery.com;
        fastcgi_cache_valid 200 301 302 60m;
        
        fastcgi_cache_min_uses 1;
        fastcgi_cache_lock on;
        
        add_header X-FastCGI-Cache $upstream_cache_status;
        add_header WP-Bullet-Skip $skip_reason;

        fastcgi_cache_valid 404 1m;
        fastcgi_cache_valid 500 502 504 5m;

       include fastcgi_params;
    }   
        

but I am wondering how to skip cache only on home page.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.