# Exclude specific location from cache

**URL:** <https://www.ruby-forum.com/t/exclude-specific-location-from-cache/243711>\
**Category:** NGINX\
**Created:** [December 24, 2015, 10:02am UTC](https://www.ruby-forum.com/t/exclude-specific-location-from-cache/243711 "2015-12-24T10:02:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [December 24, 2015, 10:02am UTC](https://www.ruby-forum.com/t/exclude-specific-location-from-cache/243711/1 "2015-12-24T10:02:19Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA256

Hello!

Currently my configuration looks like this :

map $request\_method $purge\_method {  
PURGE 1;  
default 0;  
}

map $arg\_geoloc $bypass {  
default 1;  
1 0;  
}

# Exclude from cache

# Expected URL [http://domain.tld/](http://domain.tld/)

location = / {  
proxy\_pass […];  
proxy\_no\_cache $bypass;  
proxy\_cache\_bypass $bypass;  
}

# Expected URL [http://domain.tld/indeks/](http://domain.tld/indeks/)\*

# Expected URL [http://domain.tld/kanal/](http://domain.tld/kanal/)\*

location ~ ^/(indeks|kanal)/ {  
proxy\_pass […];  
proxy\_no\_cache $bypass;  
proxy\_cache\_bypass $bypass;  
}

# The rest are cached

# Expected URL [http://domain.tld/](http://domain.tld/)\* (except the condition above)

location / {  
proxy\_pass […];  
proxy\_cache my\_cache;  
proxy\_cache\_purge $purge\_method;  
proxy\_cache\_use\_stale error timeout updating http\_500 http\_502  
http\_503 http\_504;  
proxy\_cache\_valid 200 206 302 1h;  
proxy\_cache\_valid any 3s;  
proxy\_cache\_lock on;  
proxy\_cache\_revalidate on;  
proxy\_cache\_min\_uses 10;  
}

My goal is, exclude the homepage, indeks and kanal pages, then cache  
the rest URL. Am I right with the configuration above?

Any help and advice are appreciated.  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v2

iQIcBAEBCAAGBQJWe7R/AAoJEOV/0iCgKM1w+o4P/RuZ3NJ1BiQ1B30kapHsAHhm  
ylW7O8E0Qx5vLF8aR0BzI3TTTsHEva9jXOrHwOf1+CiT+z/07IBvhjqDHOKhKdr5  
46kMM9m/7L5ZEmH+AWM/InDQWgVkvP1UEJkYNoOAGB/NkT+zVv7g+MvJEmcf/abP  
BJxektr8j8NldhNx5QiSZswz2AChpg67wh/aWX0Q4vtytZOYn+1/lxMteQjrRBQa  
Ub75uw5yiPIKLTABdEBUJV4ulI+yel8VD6o0LOc1xbt4MUh/31Vp8kN5YziOhOK8  
DB5bvCdLTFHyu8Bv8sAEmhuPxJiJ9Y9oL/HHVp5NTkDqNle7Otnr/f25jxnSFcYK  
9OLY5UbWw6We8nJMk1psKbVWXPMdUBnAIvdRfIMcgHHb7QFmxxBfoCLiN7Xpt60g  
v4o7pGa5Oz/OVE/XdUT79uLE9vbRdFM8ZoXxkLa2mTPvUzndXuqyzgx+2GAlghb8  
5te+y/aCskYAL9b/retRQrp/dBBe3TqY9Ni8CTuoZ+SgUOhk07aYIGB7Q7pEY5Sd  
cauWrxT4ijthE/GOM3NP7lVEtq5Cz+XDb9n5V2PFqxYi1LsLix6sYCIYwnYkVAqV  
E44MAuViVFpj+NULcriNnU3HNJB6OWQdoEcNXodHUwm71k8ctPUSBrQK5w6c42xP  
R6qDdDpqFU0oKoooXRHG  
=tzpt  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![Dewangga\_Bachrul\_Al](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/8c91f0/32.png) [@Dewangga\_Bachrul\_Al](https://www.ruby-forum.com/u/Dewangga_Bachrul_Al)\
**Post date:** [December 24, 2015, 10:24am UTC](https://www.ruby-forum.com/t/exclude-specific-location-from-cache/243711/2 "2015-12-24T10:24:31Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA256

Sorry I forgot something, I’m using Nginx Plus R7.

nginx version: nginx/1.9.4 (nginx-plus-http2-r7-p1)  
built by gcc 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC)  
built with OpenSSL 1.0.1e-fips 11 Feb 2013  
TLS SNI support enabled  
configure arguments: --build=nginx-plus-http2-r7-p1

- –prefix=/etc/nginx/ --sbin-path=/usr/sbin/nginx
- –conf-path=/etc/nginx/nginx.conf
- –error-log-path=/var/log/nginx/error.log
- –http-log-path=/var/log/nginx/access.log
- –pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock
- –http-client-body-temp-path=/var/cache/nginx/client\_temp
- –http-proxy-temp-path=/var/cache/nginx/proxy\_temp
- –http-fastcgi-temp-path=/var/cache/nginx/fastcgi\_temp
- –http-uwsgi-temp-path=/var/cache/nginx/uwsgi\_temp
- –http-scgi-temp-path=/var/cache/nginx/scgi\_temp --user=nginx
- –group=nginx --with-http\_ssl\_module --with-http\_v2\_module
- –with-http\_realip\_module --with-http\_addition\_module
- –with-http\_sub\_module --with-http\_dav\_module --with-http\_flv\_module
- –with-http\_mp4\_module --with-http\_gzip\_static\_module
- –with-http\_gunzip\_module --with-http\_random\_index\_module
- –with-http\_secure\_link\_module --with-http\_stub\_status\_module
- –with-http\_auth\_request\_module --with-mail --with-mail\_ssl\_module
- –with-threads --with-file-aio --with-ipv6 --with-stream
- –with-stream\_ssl\_module --with-http\_f4f\_module
- –with-http\_session\_log\_module --with-http\_hls\_module
- –with-cc-opt='-O2 -g -pipe -Wall -Wp,-D\_FORTIFY\_SOURCE=2 -fexceptions
- -fstack-protector-strong --param=ssp-buffer-size=4
- -grecord-gcc-switches -m64 -mtune=generic’

On 12/24/2015 04:01 PM, Dewangga Bachrul Alam wrote:

> $bypass; }  
> proxy\_cache\_valid any 3s; proxy\_cache\_lock on;  
> proxy\_cache\_revalidate on; proxy\_cache\_min\_uses 10; }
> 
> My goal is, exclude the homepage, indeks and kanal pages, then  
> cache the rest URL. Am I right with the configuration above?
> 
> Any help and advice are appreciated.

-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v2

iQIcBAEBCAAGBQJWe7m5AAoJEOV/0iCgKM1w42YQAIor0QWCF6yiqM0Ea+Ek+LnU  
BJUMe+bJecJsStV++S6QnfpaqcvDBr4hl5NzsgdG1eY3BX2rKWx6AGMMJAlrgTuI  
eHSeb3Fvd7OBkGp0hr6+wkeeMfn/KsFL3kPwqqfS7KDAsH2z43Jzznj5XttFH+Vo  
GcGHMDqUtLURWxepXpfFAWsfHWmv4MbD1pGksbLlBnYMS8wkIgn0+mUlTSkYTldi  
SxWwtkRLDA2mQhw8vE99o3nmgpv26qTXJTX8+DgHOx3yhX364Ka8i4egSgrQO81a  
oYT6HP07R6o63CdjY8b7aShG7IwtOMYf7NM3bn7eu/9dn8t/y0vzfRRtN9ZtHnsp  
ejp8BiFkodOMclW27CQ2oMWIv7IJJuVV3q5IyVNFARYK1sGKM3GKWyiZLy+rLVGU  
K3SUnvPO9dH1d9UyzvnzLf/bS7EwXhdPnPkOIiX1xdN/RJls8XJogLBNxqaF/mHo  
ih0xTDvpLO6sYcEmSjECy1WZDoxmFbiL5pVi0sWD5unFoUuUk+XoFbrJCzi3tMTv  
CWUZt1WbOxV3sgQRHbnH6ZyzYOFaAaLPBYgCWJR8uRXGTtn2ybSYhFLtkNxsjxgO  
RqRYBptVbdRPbHb5AAU9YOh8Vi2ktMZCoX016pdLXvnm0l/ikYrf903e9wMO7DSB  
9mCYvrrRShJqCRifm7GT  
=z8GZ  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![Dewangga\_Bachrul\_Al](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/8c91f0/32.png) [@Dewangga\_Bachrul\_Al](https://www.ruby-forum.com/u/Dewangga_Bachrul_Al)\
**Post date:** [December 24, 2015, 10:29am UTC](https://www.ruby-forum.com/t/exclude-specific-location-from-cache/243711/3 "2015-12-24T10:29:11Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

On 12/24/15 12:24 PM, Dewangga Bachrul Alam wrote:

> Sorry I forgot something, I’m using Nginx Plus R7.

[…]

Hi Dewangga,

please open a support ticket. Our engineers will help you with that  
in a minute.

* * *

Maxim K.  
-----BEGIN PGP SIGNATURE-----

iEYEARECAAYFAlZ7uroACgkQ7PDpCywXIIPx1QCfUIaXwI705Ft/XWrfKfYOuCI+  
EpcAoKq8XaXyAYTKDkgfPwSMb6G92fQP  
=kLMV  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![Dewangga\_Bachrul\_Al](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/8c91f0/32.png) [@Dewangga\_Bachrul\_Al](https://www.ruby-forum.com/u/Dewangga_Bachrul_Al)\
**Post date:** [December 24, 2015, 10:48am UTC](https://www.ruby-forum.com/t/exclude-specific-location-from-cache/243711/4 "2015-12-24T10:48:28Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA256

Hello!

On 12/24/2015 04:28 PM, Maxim K. wrote:

> On 12/24/15 12:24 PM, Dewangga Bachrul Alam wrote:
> 
> > Sorry I forgot something, I’m using Nginx Plus R7.
> 
> […]
> 
> Hi Dewangga,
> 
> please open a support ticket. Our engineers will help you with  
> that in a minute.

Re-send to nginx-plus support 🙂  
Thank you Maxim.

[..]  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v2

iQIcBAEBCAAGBQJWe79eAAoJEOV/0iCgKM1wPa0QAJxaOgqw5s8OOa+IgwFq7xc/  
LitVKRHukMVxskkpzehliu7OZ6UVv2J1uiJ3z4ltbbQ3Cie/XiWkutI1F25ur45K  
7aLjCml9X3gaiYQ75GlS0zdJQD9gR6YmvVdHbv8SggUWQYHz7cFgPwP9lSE3Bo/O  
P7MEen8k3xYxkHK24B/jGg+DB+SH0s9mIChyhtqtbx0PkNsJbIHsQSB06Sle5I1E  
nQB81x3FvzCEhQfJXgUlZDWJgMe8+aw64ooexBpcE/yxSiYZ0vZxkGQT3VZUKHYn  
GdblSmLcQyWWqaId+5OXRMNVDQXfwIJAKLrfAQRG8KSiXp2yAgoTZrv4PC6lVcLa  
RGAbhdf7z8sIisTlhDOaO0PGbdll2j08jQMARK6bdnd5ZxCv8JKZkhXimXUmt/4e  
uN7r3f6jTcL4dr1RJ4V9QAsIeAhKUV8JJ+zrSfzd7Ts8Y7bzQeH2mvtziJKAA1yG  
ZoYF6UoWe67HyCsoYRpMXMahmSnAp+3DiTc9C4I4AxeanJTbpxADu2W83LdxOb51  
We4N8vdFcjRrYqnclT0QQKezZEkXT0inSPq1H/bN1MBo610cryOemnSbrSO+bmEt  
vqzg8M3vNSsHL+wXEmAmOcwN6/7U4D5kRhno6gsLfg/aS45N3pmdj7RjIkoEDafb  
0hI9g54DFT6CazqXGNBT  
=LXxw  
-----END PGP SIGNATURE-----
