• Resolved cheonmu

    (@cheonmu)


    Hi,

    I set my mobile page so it automatically re-directs to AMP mode.

    But when I often check it, some pages are directed to mobile and others to ordinary page.

    I used AMP VALLiDATE tool to check but both pages had no issues.

    Does redirection to AMP mode affect cache plug-in? I am using wp-rocket and Fastcgi(Nginx) cache both.

    What should I do to re-direct all pages normally to mobile?

    Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Can you please share your website URL? So we can analyze it and help you fix the issue for you.

    Thread Starter cheonmu

    (@cheonmu)

    @ahmedkaludi

    Hi,

    After deactivating Fast-cgi cache of Nginx,

    I found out that the problem in concern is resolved.

    But how can I make Fastcgi cacche operate normally with AMPFORWP plugin?

    Is there something I need to exclude from cache for Redirect to be normally operated?

    Thank you.

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    We understand your issue. So please share your website URL. After testing we can analyze and help you to fix it.

    Thread Starter cheonmu

    (@cheonmu)

    @ahmedkaludi

    Hi, Thanks for answering.

    My website is here

    Now i am using Wp rocket with Redis object cache instead of Nginx Fastcgi cache and its working good.

    When i used Fastcgi cache, i put below code in my server block.

    Thank you.

    
    ====Nginx config====
    fastcgi_cache_path /var/cache/nginx/vg levels=1:2 keys_zone=vg:10m max_size=2G inactive=60m;
    
        fastcgi_cache_key "$scheme$request_method$host$request_uri";	
    	fastcgi_cache_lock on;
    	fastcgi_cache_revalidate on;
    	fastcgi_cache_background_update on;
    	fastcgi_cache_use_stale error timeout invalid_header updating http_500;
    	fastcgi_cache_valid any 60m;
    	fastcgi_pass_header Set-Cookie;
    	fastcgi_pass_header Cookie;
    	fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
    
    ===Server block===
    location ~ \.php$ {
             include snippets/fastcgi-php.conf;
             fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    
    		set $skip_cache 0;
    		# POST requests and url's with a query string should always skip cache
    		if ($request_method = POST) {
    		set $skip_cache 1;
    		}
    		if ($query_string != "") {
    		set $skip_cache 1;
    		}
    		# Don't cache url's containing the following segments
    		if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml") {
    		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;
    		}
    		# (for some reason, add_header fails if included in prior if-block)
    		if ($skip_cache = 1) {
    		add_header Set-Cookie "_mcnc=1; Max-Age=2; Path=/";
    		add_header X-Microcachable "0";
    		}
    		# Bypass cache if no-cache cookie is set
    		if ($http_cookie ~* "_mcnc") {
    		set $skip_cache 1;
    		}
    		fastcgi_cache_bypass $skip_cache;
    		fastcgi_no_cache $skip_cache;
    		fastcgi_cache vg;
    		include fastcgi_params;
    		fastcgi_buffer_size 128k;
    		fastcgi_connect_timeout 120s;
    		fastcgi_send_timeout 120s;
    		fastcgi_read_timeout 120s;
    		fastcgi_buffers 256 16k;
    		fastcgi_busy_buffers_size 256k;
    		fastcgi_temp_file_write_size 256k;
            add_header X-F-Cache $upstream_cache_status;
    	}
    
    	location ~ /purge(/.*) {
    	    fastcgi_cache_purge vg "$scheme$request_method$host$1";
    	}		
    
    • This reply was modified 5 years, 2 months ago by cheonmu.
    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    We checked your issue. The Fast-CGI cache is not working in the mobile redirection in AMP.

    • This reply was modified 5 years, 2 months ago by Ahmed Kaludi.
    Thread Starter cheonmu

    (@cheonmu)

    @ahmedkaludi

    Hi, Thanks for answering.

    Is there any plan this problem will be corrected?

    Or do I need to find a solution in Fastcgi?

    Thank you.

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Currently, we don’t have any solutions. But we are planning to solve the issue. That will be updated in our future updates.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘About redirect to amp mode’ is closed to new replies.