Welcome! Log In Create A New Profile

Advanced

Re: Problems with cache by mime/type

Francis Daly
November 30, 2018 08:14AM
On Thu, Nov 29, 2018 at 09:51:13PM -0200, Jorge Pereira wrote:

Hi there,

> I am using the nginx/1.12.0 and I am trying to use the below config.
> but, the below "map" by "$upstream_http_content_type" is always
> matching with default value "1". but, if I remove "proxy_cache_bypass"
> then the map it works. therefore, I need the "proxy_cache_bypass "
> capability.

It looks like you want to bypass the cache (and therefore always serve
these requests from upstream), for certain requests.

Is that correct?

If so -- you must set the "$no_cache" variable based on something in
the request, not on something in the response like a $sent_http_ variable.

> map $sent_http_content_type $no_cache {
> default 1;
>
> application/zip 0; # *.zip files
> application/octet-stream 0; # /artifactory/api/pypi and any
> other binary files.
> application/java-archive 0; # *.jar
> application/x-nupkg 0; # /artifactory/api/nuget/.*/Download/.*
> }

Perhaps try setting $no_cache based on $request_uri or $document_uri? That
might fit three of the four above.

(Alternatively: set $no_cache to 0 by default, and to 1 based on requests
that you are happy to potentially have served from the cache.)

> proxy_cache artifactory_cache;
> proxy_cache_bypass $no_cache;
> proxy_no_cache $no_cache;

Good luck with it,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Problems with cache by mime/type

Jorge Pereira November 29, 2018 06:52PM

Re: Problems with cache by mime/type

Francis Daly November 30, 2018 08:14AM

Re: Problems with cache by mime/type

Jorge Pereira November 30, 2018 08:34AM

Re: Problems with cache by mime/type

Francis Daly November 30, 2018 09:06AM

Re: Problems with cache by mime/type

Jorge Pereira November 30, 2018 09:16AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 237
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