nginx メンテナンスページへリダイレクト 405 Not Allowed. can not post to static page!

ページを返すパス(/action/)にアクセスしたら maintenance.html か ajaxパターンだったら .jsonを返す。
systemディレクトリはキャッシュしないように 0を指定。
messagepackを使っていたので、それようのヘッダーを返すように追加

 location /action/ {
   rewrite ^/actction/game/.*/\-/.*  /system/maintenance.msgpack last;
   rewrite ^ /system/maintenance.html last;
   return 404;
 }
 location ^~ /system {
   root    /home/catwork.mixi/web;
   expires 0;
   types {
     “application/x-msgpack;charset=x-user-defined” msgpack;
     application/json json;
   }
   default_type text/html;
 }

と書いたのですが、POSTすると 404 not allowedと出てしまい。static fileにpostできないと。

そこで405に該当ファイルを渡す。

error_page 405=$uri

とすると405がmaintenance.htmlかjsonになるのでOKとなりました。

This entry was posted on 水曜日, 2月 13th, 2013 at 9:33 AM and is filed under nginx. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Unityによるゲームを公開しております iOS/Android
https://itunes.apple.com/jp/app/lost-knight-3d-action/id900917032
https://play.google.com/store/apps/details?id=com.groundroad.runknight

各種開発支援・機能開発等小さいお仕事などもお請けしております。
unity開発支援, PHPシステム開発, javascript/html5 フロント開発, titanium mobileアプリ開発
お気軽にお問い合わせください
大崎・五反田近郊での対面でのお打ち合わせはいつでも可能です。