Different locations based on $request_method
Aaron Starr
astarr at wiredquote.com
Thu Dec 2 23:55:24 MSK 2010
Hello, all,
I would like to configure nginx to return a file if the request method is
GET. But, if the request method is PUT or POST, I'd like for the back end to
handle it. So, ideally, something like this:
location / GET {
try_files $uri $uri/index.html $uri.html @missing;
}
location / PUT {
proxy_pass http://sinatra;
....
}
location @missing {
return 404;
}
I understand that that particular syntax isn't possible. Is something like
this the best way to do it?
location / {
if ($request_method = PUT) {
proxy_pass http://sinatra;
....
break;
}
try_files $uri $uri/index.html $uri.html @missing;
}
location @missing {
return 404;
}
I'm aware that if==bad, but not sure if there's a better way to redirect
traffic based on the request method?
Thanks for any help,
Aaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20101202/5bd06e58/attachment.html>
More information about the nginx
mailing list