Francis Daly
November 30, 2018 09:06AM
On Fri, Nov 30, 2018 at 11:32:39AM -0200, Jorge Pereira wrote:

Hi there,

> I sent the wrong snip. the correct is using
> $upstream_http_content_type as can be seen below. basically, always

$upstream_http_content_type is the http Content-Type header sent by
upstream in response to the request from nginx to upstream.

http://nginx.org/r/$upstream_http_

At the time that nginx is deciding "should this request be served from
cache or sent to upstream?", $upstream_http_content_type cannot have
a value.

Your $no_cache variable that is used in the proxy_cache_bypass directive
can only usefully be made up of things that are available in the request
from the client to nginx.

> when I use "proxy_cache_bypass $no_cache;" that impact the value of
> "map $upstream_http_content_type $no_cache".... I didn't understand
> what is the reason. thanks for any suggestions.

When "proxy_cache_bypass" is used, it must find the value of the variable
$no_cache. At that time, $upstream_http_content_type is empty, so $no_cache
maps to 1.

When "proxy_no_cache" is used, it must find the value of the variable
$no_cache. If $no_cache was set to 1 previously, it will keep that
value. If $no_cache was not set previously, nginx will check the map,
and now potentially set $no_cache to 0.

That is why your "proxy_no_cache" sees a different value depending on
whether "proxy_cache_bypass" is commented out or not.

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: 247
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