Welcome! Log In Create A New Profile

Advanced

Re: proxy_pass and $content_type

September 15, 2009 08:46AM
On Tue, Sep 15, 2009 at 01:40:06PM +0200, Cedric Jeanneret wrote:

> 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...

You should use 0.7.62, because
1) it can cache content instead of varnish,
2) it has image_filter, that tests that response has valid GIF, PNG, JPEG:

location / {
proxy_pass ...
image_filter test;
error_page 415 =403 /403.html;
}

location /403.html {
root path/to/page;
}


--
Igor Sysoev
http://sysoev.ru/en/
Subject Author Posted

proxy_pass and $content_type

Cedric Jeanneret September 15, 2009 08:46AM

Re: proxy_pass and $content_type

Igor Sysoev September 15, 2009 08:46AM

Re: proxy_pass and $content_type

Maxim Dounin September 15, 2009 08:46AM

Re: proxy_pass and $content_type

Cedric Jeanneret September 15, 2009 09:12AM

Re: proxy_pass and $content_type

Igor Sysoev September 15, 2009 09:22AM

Re: proxy_pass and $content_type

Maxim Dounin September 15, 2009 10:42AM

Re: proxy_pass and $content_type

Cédric Jeanneret September 15, 2009 12:02PM

Re: proxy_pass and $content_type

Maxim Dounin September 15, 2009 12:20PM

Re: proxy_pass and $content_type

Cédric Jeanneret September 15, 2009 01:42PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 177
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready