proxy_pass and $content_type

Cedric Jeanneret cedric.jeanneret at
Tue Sep 15 15:40:06 MSD 2009

Hello all,

We're wanting to use nginx as a proxy between a varnish and a S3 storage. We're using debian lenny, nginx version is 0.6.32-3.

What we're dowing:

server {
  location / {
    proxy_pass ...
    if ($content_type !~* "image/") {
      return 403

What happens ? well, 403 for all. We put in log "$content_type", and saw it's set to "-".

Is it normal? Is there another way to filter by content type?
Our final goal is:
S3 sends either the file if it can find it, or an XML (so a content_type "text/xml" or smth like that). We don't want to give the xml, as it contains S3 bucket name...

If any of you has an idea/fixe/workaround...

Thanks in advance

Best regards,


Cédric Jeanneret                 |  System Administrator
021 619 10 32                    |  Camptocamp SA
cedric.jeanneret at  |  PSE-A / EPFL
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <>

More information about the nginx mailing list