using $upstream* variables inside map directive

Francis Daly francis at daoine.org
Thu Nov 12 16:48:34 UTC 2020


On Thu, Nov 12, 2020 at 11:00:09AM -0500, unoobee wrote:

Hi there,

> > And you are reporting that it does not ever write to "ssd_cache".
> Yes, this is correct. I want to choose the cache location based on the size
> of the cached file

Logically, you can't.

You can only choose the cache location based on something in the request;
not on something in the response.

> I want to get the behavior described in the article, but only with the file
> size in the map directive, I assume I need $sent_http_content_length or
> $upstream_http_content_length.

You could try changing all your urls to include the file size; and then
choose a cache location based on the sizes in the request url.

But that is unlikely to be convenient.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list