Ajax POST error 405

Ijust installed ngnix on my server. All rail applications works perfect,
but i have some static sites where i use AJAX for content replacement
and i get 405 Not allowed error.
Server config:
server {
listen 80;
server_name www.clean-tech.ro clean-tech.ro ;

access_log /srv/www/vhosts/clean-tech/www/log/nginx.log main;

location / {
  root /srv/www/vhosts/clean-tech/www;
  index  index.html index.htm;
}
#error_page  404              /404.html;

error_page   500 502 503 504  /50x.html;
location = /50x.html {
  root   /srv/www/htdocs/;
}

}
I tried
error_page 405 = @405;
location = @405 {
root /srv/www/vhosts/clean-tech/www;
}
but after this workaround i get error 500

Headers:
Host clean-tech.ro
User-Agent Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.9)
Gecko/20071101 SUSE/2.0.0.9-2.1 Firefox/2.0.0.9
Accept text/javascript, text/html, application/xml, text/xml, /
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 300
Connection close
X-Requested-With XMLHttpRequest
X-Prototype-Version 1.5.0_rc1
Content-Type application/x-www-form-urlencoded
Referer http://clean-tech.ro/
Content-Length 0
Cookie
__utmz=240299857.1195540804.10.5.utmccn=(referral)|utmcsr=blog.hkcc.ro|utmcct=/2007/11/16/test|utmcmd=referral;
__utma=240299857.1171685038.1191992038.1195504186.1195540804.10;
__utmb=240299857; __utmc=240299857
Pragma no-cache
Cache-Control no-cache

Hello Ferenc-lorant,

Tuesday, November 20, 2007, 2:16:25 PM, you wrote:

Ijust installed ngnix on my server. All rail applications works perfect,
but i have some static sites where i use AJAX for content replacement
and i get 405 Not allowed error.
Server config:
server {
listen 80;
server_name www.clean-tech.ro clean-tech.ro ;

access_log /srv/www/vhosts/clean-tech/www/log/nginx.log main;
location / {
  root /srv/www/vhosts/clean-tech/www;
  index  index.html index.htm;
}
#error_page  404              /404.html;
error_page   500 502 503 504  /50x.html;
location = /50x.html {
  root   /srv/www/htdocs/;
}

}
I tried
error_page 405 = @405;
location = @405 {
root /srv/www/vhosts/clean-tech/www;
}
but after this workaround i get error 500

why aren’t you using GET requests instead of POST?

Denis F. Latypoff wrote:

why aren’t you using GET requests instead of POST?

Hello Denis F. Latypoff wrote:

:slight_smile: I don’t use POST but prototype.js (new.Ajax)which i use for AJAX
uses.

my js

function _home() {
document.getElementById(‘content’).innerHTML = '

O clipă …
';
Element.hide(‘lnk2pct’);
!!! new Ajax.Updater(‘content’, ‘src/home.html’, {asynchronous:true,
evalScripts:true}); !!!
return false;

calls
prototype.js line 736

this.transport.send(this.options.method == ‘post’ ? body : null);

Do you know a workaround ?

Thx for reply

Igor S. wrote:

On Tue, Nov 20, 2007 at 09:16:25AM +0100, Ferenc-lorant Kiss wrote:

location / {

}
I tried
error_page 405 = @405;
location = @405 {
root /srv/www/vhosts/clean-tech/www;
}
but after this workaround i get error 500

nginx as many servers does not support POSTing to static files.
However, it could changed.

Thx

then I’ll rewrite static sites in rails applications :frowning:

On Tue, Nov 20, 2007 at 09:16:25AM +0100, Ferenc-lorant Kiss wrote:

location / {

}
I tried
error_page 405 = @405;
location = @405 {
root /srv/www/vhosts/clean-tech/www;
}
but after this workaround i get error 500

nginx as many servers does not support POSTing to static files.
However, it could changed.

Ferenc-Lorant Kiss wrote:

I am a stupid,lazy ignorant :slight_smile:

Ijust read on http://www.prototypejs.org , I can use method :‘get’

new Ajax.Updater(‘content’, ‘src/home.html’, { method: ‘get’,
asynchronous:true, evalScripts:true});

and everithing works fine

Sorry for your trouble

Thx