Francis Daly
November 01, 2022 06:10PM
On Wed, Nov 02, 2022 at 12:29:49AM +0800, Drweb Mike wrote:

Hi there,

> My front end is nginx using reverse proxy work with my backend, I was
> trying to cache images files only, but it seems doesn't work at all, the
> *$no_cache* always output default value "proxy", which should be "0" when I
> visit image files

$upstream_http_content_type is the Content-Type response header from the
upstream server, after nginx has sent a request to the upstream server.

Before nginx has sent a request to the upstream server, the variable
has no value.

If you want to use variables to decide whether nginx should handle a
request by looking in the cache before asking upstream, you should only
use variables that are available in the request, not ones that come
from upstream.

(Maybe you can use part of the request uri -- starts with /images/ or
ends with .jpg or .png, for example? It depends on what requests your
clients will be making.)

> why *$upstream_http_content_type* map doesn't works as expected

Your expectation is wrong.

Cheers,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list -- nginx@nginx.org
To unsubscribe send an email to nginx-leave@nginx.org
Subject Author Posted

how can I cache upstream by mime type in nginx

Drweb Mike November 01, 2022 12:32PM

Re: how can I cache upstream by mime type in nginx

Francis Daly November 01, 2022 06:10PM

Re: how can I cache upstream by mime type in nginx

Francis Daly November 01, 2022 06:16PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 105
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready