Welcome! Log In Create A New Profile

Advanced

[Help] Nginx regex issue for domain name filter

Posted by kkumar326 
[Help] Nginx regex issue for domain name filter
April 17, 2019 07:20AM
My website has different themes for mobile and desktop pages and that's why I want to filter the homepage as the cache is breaking the UI on devices. I tried adding:

# Don't cache domain names
if ($request_uri ~* "sciencehook.com($|/$)") {
set $skip_cache 1;
}

but it didn't work. It's caching sciencehook.com anyways. Please let me know the mistake here.

Cache section looks like this:

# Don't cache domain names
if ($request_uri ~* "sciencehook.com($|/$)") {
set $skip_cache 1;
}

# Don't cache uris 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;
}

Thank you!
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 202
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready