• Hello!
    After setting the option to reduce spam in comments, an error occurs while adding a comment. When a user wants to add a comment the error 405 Not Allowed comes out. The site is on nginx

Viewing 4 replies - 1 through 4 (of 4 total)
  • The only setting in this plugin that might return a 405 code is the “Multiple Authentication Attempts per XML-RPC Request” setting (when set to the value “Block”) in the WordPress Tweakss module.

    Probably makes no difference but, if it’s currently set to the value “Block”, what happens when you set it to “Allow” ?

    Thread Starter Timur

    (@timkin)

    No, this is due to blocking spam comments. As soon as I disable this option, everything starts working immediately.

    The Reduce Comment Spam setting (once enabled) will only add some rules to the (plugin) nginx.conf configuration file. Assuming this file gets included into the main nginx.conf file AND the last mentioned file is reloaded (or nginx restarted) after any changes, perhaps there is a problem with the rules added …

    Temporarily comment the added rules in the (plugin) nginx.conf configuration file and do the nginx reload (or restart) thing and then see what happens …

    However if the added rules are not picked up by nginx in the first place there is no point in doing the above. The nginx configuration wasn’t affected at all by enabling the Reduce Comment Spam setting …

    However if the rules are correct and in effect comments blocked will receive a 403 code …

    Weird enabling the setting seems to cause the 405 …

    Peeked into the wp-comments-post.php file and noticed it starts with this:

    if ( 'POST' != $_SERVER['REQUEST_METHOD'] ) {
    	$protocol = $_SERVER['SERVER_PROTOCOL'];
    	if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) {
    		$protocol = 'HTTP/1.0';
    	}
    
    	header('Allow: POST');
    	header("$protocol 405 Method Not Allowed");
    	header('Content-Type: text/plain');
    	exit;
    }

    It would indicate the submitted comment does not have the POST request method…

    Thread Starter Timur

    (@timkin)

    And then how to solve the problem?

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘wp-comments-post 405 Nginx’ is closed to new replies.