rewrite POST into GET?

Kenneth Demanawa kdemanawa at gmail.com
Thu Feb 14 14:47:00 MSK 2008


hi mark.

maybe something like ..


 ...
location / {
 # ...

  if ($request_method = POST ) {
      rewrite  (.*)  /system_maintenance.html
     proxy_pass        http://rails_app;
   }

}

ciao :)


On Thu, Feb 14, 2008 at 6:12 PM, Mark Slater <lists at humanesoftware.com> wrote:
> I'm working on a facebook application built using Rails. This is my
>  first time deploying a Rails site, and I'm setting up Capistrano to do
>  the heavy lifting. I've got it creating a "down for maintenance" file
>  that I would like served to all facebook requests when I'm updating
>  things, but facebook always sends a POST request. This causes Nginx to
>  respond with a 405 and report "client sent invalid method...";
>  obviously you can't really POST to a static page.
>
>  Is there a way I can re-direct POST requests to GET requests or force
>  Nginx to return the static page regardless of the method used to
>  access it? My backup plan is to deploy a second app on a different set
>  of ports that always returns the "down for maintenance" message....
>  but it seems silly to run one app to report you're upgrading another.
>
>  Thanks!
>
>  Mark
>
>





More information about the nginx mailing list