couchdbのプロキシフロントエンドとしてnginx0.6.32を実行しています。データベースにrobots.txtがあり、http://www.example.com/prod/_design/mydesign/robots.txtとしてアクセスできます。同様のURLで動的に生成されるsitemap.xmlもあります。
私は次の設定を試しました:
server {
listen 80;
server_name example.com;
location / {
if ($request_method = DELETE) {
return 444;
}
if ($request_uri ~* "^/robots.txt") {
rewrite ^/robots.txt http://www.example.com/prod/_design/mydesign/robots.txt permanent;
}
proxy-pass http://localhost:5984;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
これはリダイレクトとして機能するように見えますが、もっと簡単な方法はありますか?