Quantcast
Channel: Nginx Forum - Nginx Mailing List - English
Viewing all articles
Browse latest Browse all 7229

Re: Abstract behavior of nginx (no replies)

$
0
0
Hello!

On Fri, Nov 22, 2013 at 02:47:23PM +0100, Pomorski Jarosław wrote:

> Hi,
>
> I can't understand behavior of nginx.
> Version 1.2.1 on Debian Wheezy from official repository. I send
> requests to cdn.some_domain.pl server, and in log
> /var/log/nginx/cdn.some_domain.pl/test.log I see:
>
> image/gif:1
> image/png:1
> image/png:1
> image/gif:1
> image/png:1
> image/gif:1
>
> It is correct. If I remove hash sign in 3 last line of
> configuration file, nginx puts to
> /var/log/nginx/cdn.some_domain.pl/test.log below entries:
>
> -:0
> -:0
> -:0
> -:0
> -:0
> -:0
>
> I don't understand, why in this configuration, value of
> $sent_http_content_type variable is empty.

[...]

> map $sent_http_content_type $cdn {
> default 0;
> text/css 1;
> text/javascript 1;
> image/x-icon 1;
> image/gif 1;
> image/jpeg 1;
> image/png 1;
> }

[...]

> # if ($cdn) {
> # return 404;
> # }

The "if ($cdn)" is evaluated while processing rewrite rules, and
at this point value of $sent_http_content_type isn't yet known
(because response isn't sent). But due to this evaluation
calculated values of the $sent_http_content_type and $cdn
variables are cached, and not re-evaluated again later.

That is, what you see in logs is a value of the
$sent_http_content_type variable at the time the variable was
evaluated for the first time during request processing.

--
Maxim Dounin
http://nginx.org/en/donation.html

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Viewing all articles
Browse latest Browse all 7229

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>