php - amazon aws 405 method not allowed when submitting form -


recently have started using amazon's aws web hosting , html contact form not seem work anymore, comes error when clicking on submit button.

<html> <head><title>405 method not allowed</title></head> <body> <h1>405 method not allowed</h1> <ul> <li>code: methodnotallowed</li> <li>message: specified method not allowed against resource.</li> <li>method: post</li> <li>resourcetype: object</li> <li>requestid: a8750f9d0586c1e5</li> <li>hostid: fhjhs//wnjvj8gle/hkvzkaibq9druhnjxobj8earsvaburpws87twivbiscgnzaefne9lllvni=</li> </ul> <hr/> </body> </html> 

my html:

<div class="email-form">     <form id="ajax-contact" method="post" action="mailer.php">         <div class="flex-input-wrap">             <input type="text" placeholder="name" name="name" id="name" class="flex-input-1" required="">             <input type="email" placeholder="email" name="email" id="email" class="flex-input-2" required="">         </div>         <textarea type="text" placeholder="enter text" name="message" id="message" required=""></textarea>         <button type="submit" class="submit-button">send message</button>     </form>     <div id="form-messages"></div> </div> 

js:

$(function () {     var e = $("#ajax-contact"),         = $("#form-messages");     $(e).submit(function (s) {         s.preventdefault();         var r = $(e).serialize();         $.ajax({             type: "post",             url: $(e).attr("action"),             data: r         }).done(function (e) {             $(a).removeclass("error"), $(a).addclass("success"), $(a).text(e), $("#name").val(""), $("#email").val(""), $("#message").val("")         }).fail(function (e) {             $(a).removeclass("success"), $(a).addclass("error"), $(a).text("" !== e.responsetext ? e.responsetext : "oops! error occured , message not sent.")         })     }) }); 

mailer.php file:

<?php     if ($_server["request_method"] == "post") {         $name = strip_tags(trim($_post["name"]));         $name = str_replace(array("\r","\n"),array(" "," "),$name);         $email = filter_var(trim($_post["email"]), filter_sanitize_email);         $message = trim($_post["message"]);         if ( empty($name) or empty($message) or !filter_var($email, filter_validate_email)) {             http_response_code(400);             echo "oops! did forget fill out something? try again.";             exit;         }         $recipient = "myemail@gmail.com";         $subject = "new email $name";         $email_content = "name: $name\n";         $email_content .= "email: $email\n\n";         $email_content .= "message:\n$message\n";         $email_headers = "from: $name <$email>";         if (mail($recipient, $subject, $email_content, $email_headers)) {             http_response_code(200);             echo "thanks! message sent.";         } else {             http_response_code(500);             echo "oops! went wrong , message couldn't sent.";         }     } else {         http_response_code(403);         echo "there problem message, please try again.";     } ?> 

is there type of setting i'm missing in aws?

thanks in advance.

guessing have statically hosted index.html in s3 , post going s3, rejects it, rather php server.


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -