Bypass cache when mobile - fastCGI_cache


#1

Hello community! :slight_smile: I have a problem with nginx configuration.

I have installed a WP site with ee site create example.com --wpfc # install wordpress + nginx fastcgi_cache

The wordpress theme that is used does not adapt to mobile, so we use WPTouch plugin. I want to be able to bypass the cache when a user is mobile. But I cant manage it. I found this to detect mobile user agents: https://gist.github.com/perusio/1326701

So i have added that code into /etc/nginx/nginx.conf, and in my htdocs/nginx.conf file, I added:

location /{

    if ($is_mobile) {
    set $no_cache 1;

}

But that doesnโ€™t work. Can somebody help me? Thanks!


#2

Solved. It had to be added to the sites-enabled/mydomain.com


#3