nginx-0.6.32-3: proxy_pass and $content_type

Mark Moseley moseleymark at gmail.com
Tue Sep 15 21:57:23 MSD 2009


On Tue, Sep 15, 2009 at 5:23 AM, Cedric Jeanneret
<cedric.jeanneret at camptocamp.com> wrote:
> Hello,
>
> We stumbled into a nice problem: we'd like to filter what nginx returns when used as a proxy_pass. We want nginx to return content only if content_type is an image, else en error like 403:
>
> server {
>        location / {
>                proxy_pass ....
>                if ($content_type !~* "image/") à
>                        return 403
>                }
>        }
> }
>
> Unfortunately, it seems that $content_type is set to "-", according to logfile....
>
> Any idea ?

If you're looking for the Content-type returned by the upstream proxy,
I believe you want $upstream_http_content_type .





More information about the nginx mailing list