rewrite POST into GET?

Igor Sysoev is at rambler-co.ru
Fri Feb 15 09:29:14 MSK 2008


On Thu, Feb 14, 2008 at 05:13:57PM -0800, Mark Slater wrote:

> Wow Igor, that was fast! Thank you!
> 
> I downloaded the development version of nginx (I'd been using the  
> previous stable version 0.5.35), and applied the patch. Unfortunately,  
> when I started the new version of the server, the post_to_static  
> didn't change the 405 result sent back to facebook.
> 
> My configuration file looks like this:
> 
> http {
>     ...
>     server {
>         listen       8080;
>         server_name  localhost;
> 
> 	# set the max size for file uploads to 50 MB.
> 	client_max_body_size 50M;
> 
>         #charset koi8-r;
> 
>         access_log  logs/host.vhost.access.log  main;
> 	root /usr/local/webapps/listage/current/public;
> 		
> 	if (-f $document_root/system/maintenance.html) {
> 		rewrite ^(.*)$ /system/maintenance.html last;
> 		break;
> 		post_to_static on;
> 	}
> 
>         location / {
>         ...
>         }
>     }
> }
> 
> Do I have that right?

I was wrong - the configuration should be changed to:

    server {

	...

	if (-f $document_root/system/maintenance.html) {
		rewrite ^(.*)$ /system/maintenance.html break;
 		break;
 	}

	location = /system/maintenance.html {
 		post_to_static on;
	}


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list