Best way to only allow specific file extensions?
David Taveras
d3taveras38d3 at gmail.com
Mon Mar 8 23:43:51 MSK 2010
Sorry,
The correct line I have is.
if ($request_uri ~*
(^\/|\.html|\.jpg|\.php|\.png|\.css|\.ico|\.js|\.swf|\.gif|robots\.txt)$
) {
return 444;
}
Now it isnt complaining about a duplicate entry.. but everything is 444
David
On Mon, Mar 8, 2010 at 3:39 PM, David Taveras <d3taveras38d3 at gmail.com> wrote:
> Hello,
>
> Iam running a reverse proxy and I would like only to relay certain
> type of extensions to the backend.. (and ofcourse any directory)
>
> location / {
> proxy_pass http://www.domain.org:80/;
> proxy_pass_header Set-Cookie;
> proxy_set_header X-Real-IP $remote_addr;
>
> }
>
> ## Only allow these file types to document root
> location / {
> if ($request_uri ~*
> (^\/|\.html|\.jpg|\.php|\.png|\.css|\.ico|\.js|\.swf|\.gif|robots\.txt)$
> ) {
> break;
> }
> return 444;
> }
>
> I have that.. but that is complaining that my config shouldnt have
> double / location. What is the best way to do what i want to anyways?
>
> thanks
>
> David
>
More information about the nginx
mailing list