Home › Forums › Any Mobile Theme Switcher › AMTS PRO + fast_cgi cache and nginx ERROR
- This topic has 5 replies, 2 voices, and was last updated 6 years, 6 months ago by Will.
-
AuthorPosts
-
June 28, 2017 at 3:57 pm #8960AlexandreGuest
I use wordpress with fast_cgi cache + nginx and the AMTS PRO plugin don’t work. The mobile theme apear in desktop device and the desktop home page apears in mobile device. Need help.
June 30, 2017 at 4:52 pm #8981DineshKeymasterHi Alexandre,
We are really sorry but anything beside W3 Total Cache won’t work with our plugin. Since the mobile and desktop shares the same url, fast_cgi cache things they are same page and cache just 1 copy of it.
Thanks
September 18, 2017 at 8:28 pm #9540WillGuestWe are having the same issue. My solution so far was to disable the cache for mobile browsers in the nginx virtual host conf file (i.e. /etc/nginx/conf.d/virtuals.conf) with the following.
if ($http_user_agent ~* "(2\.0 MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine\/3\.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA\/WX310K|LG\/U990|MIDP-2\.|MMEF20|MOT-V|NetFront|Newt|Nintendo Wii|Nitro|Nokia|Opera Mini|Palm|PlayStation Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian OS|SymbianOS|TS21i-10|UP\.Browser|UP\.Link|webOS|Windows CE|WinWAP|YahooSeeker\/M1A1-R2D2|NF-Browser|iPhone|iPad|iPod|Android|BlackBerry9530|G-TU915 Obigo|LGE VX|webOS|Nokia5800)" ) { set $no_cache 1; }
but I would like to follow this same solution from a different mobile switcher so that we can actually maintain a separate cache for mobile then for desktop per url.
Please see: https://www.wptouch.com/wptouch/optimizing-nginx-cache-wptouch-pro-3/
My question to you Dinesh is, what would the equivalent cookie parameter/value be for
`if ($http_cookie ~ ‘wptouch-pro-view=desktop’) {
set $mobile_request 0;
}`And if you don’t have that could you implement it?
Thanks.
Will
September 26, 2017 at 8:12 pm #9574WillGuestDinesh,
I was told you would respond in 24 hours by a co-worker. Maybe you missed this? This is very important to a client of ours who bought your pro version.
Will
September 28, 2017 at 8:16 am #9588DineshKeymasterHi Will,
I am so sorry for the delay in reply. Festival time here and busy with family.
Currently our plugin set amts_mobile_theme cookie when showing the mobile theme.
Hope this helps.
Thanks
October 2, 2017 at 10:47 pm #9607WillGuestAs per my research the configuraiton was successful.
In /etc/nginx/nginx.conf, I added:
fastcgi_cache_key "$scheme$request_method$host$request_uri$mobile_request";
In the /etc/nginx/conf.d/virtual_host.conf within the server block, I added
# This creates two fastcgi_cache sets, one for desktop and one for mobile. Will Long - 2017/09/28 # Use this in your key setting "fastcgi_cache_key "$scheme$request_method$host$request_uri$mobile_request";" set $mobile_request 0; if ($http_user_agent ~* "(2\.0 MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine\/3\.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA\/WX310K|LG\/U990|MIDP-2\.|MMEF20|MOT-V|NetFront|Newt|Nintendo Wii|Nitro|Nokia|Opera Mini|Palm|PlayStation Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian OS|SymbianOS|TS21i-10|UP\.Browser|UP\.Link|webOS|Windows CE|WinWAP|YahooSeeker\/M1A1-R2D2|NF-Browser|iPhone|iPad|iPod|Android|BlackBerry9530|G-TU915 Obigo|LGE VX|webOS|Nokia5800)" ) { set $mobile_request 1; } if ($http_cookie ~* 'amts_mobile_theme=go_mobile') { set $mobile_request 1; } if ($http_cookie ~* 'am_force_theme_layout=desktop') { set $mobile_request 0; }
And to make sure that the cookie response would use cache, I added this as well to the “location ~ \.php$” block I added:
fastcgi_ignore_headers Set-Cookie;
That last one should be used very carefully because you are telling the system to cache cookie responses. You should turn cache off specifically for certain cookie responses such as:
#Don't cache if there is a cookie called PHPSESSID if ($http_cookie = "PHPSESSID") { set $no_cache 1; }
and…
# 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 $no_cache 1; }
to mitigate logged in wp users sessions being cached.
-
AuthorPosts
- The topic ‘AMTS PRO + fast_cgi cache and nginx ERROR’ is closed to new replies.