Nginx-0.6.32-3: proxy_pass and $content_type

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 ?

Thanks in advance.

Best regards,

C.

On Tue, Sep 15, 2009 at 5:23 AM, Cedric J.
[email protected] wrote:

}

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 .