Bypass cache when mobile - fastCGI_cache

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

I have installed a WP site with ee site create --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:

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!

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