php - 此分发未配置为允许 HTTP 请求

标签 php html forms amazon-web-services https

This distribution is not configured to allow the HTTP request method that was used for this request. The distribution supports only cachable requests. 

我已将网站配置为仅接受亚马逊云端的 https。 简而言之,您有一个 php 登录表单,在成功登录后,它将按如下方式重定向用户:

 if(isset($_POST['login'])){

[...]
        echo "<script>window.open('coursePayment.php?crs_id=$crs_id','_self')</script>";

下面是表格:

 <form style="margin-top:-20px" method='post' action='' class='form-horizontal' role='form'>
       <input type="hidden" id="couponCodeLogin" name="couponCodeLogin">
        <input type="hidden" id="couponCodeLoginAmount" name="couponCodeLoginAmount">
<br><br>
 <div class="group">      
            <input type='text' class='form-control' name='email' required>
      <span class="highlight"></span>
      <span class="bar"></span>
      <label>Email</label>
    </div>

    <div class="group">      
            <input type='password' class='form-control' name='pass' required>
      <span class="highlight"></span>
      <span class="bar"></span>
      <label>Password</label>
    </div>


            <h5 style="color:#FF6400; cursor:context-menu; margin-top:0px" class="displayForgotPassword">Forgot your password? Click here to retrieve it.</h5><br>
            <input type='submit' id='moreInfoButton' name='login' value='Continue' class='btn btn-danger'>                               
          </form> 

最佳答案

发生此错误是因为 CloudFront 未配置为接受它正在发送的 HTTP 请求(如 POSTPATCH)。

要修复它,请将您的 CloudFront 分配设置更改为接受所有 HTTP 方法。

为此,请单击 CloudFront 分配的 Behaviors 选项卡,选择默认行为,单击 Edit,更改 Allowed HTTP MethodsGET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE,然后点击右下角的Yes, Edit 保存更改。

Change Allowed HTTP Methods in a CloudFront distribution

您的 CloudFront 分配可能需要几分钟才能传播更改。

关于php - 此分发未配置为允许 HTTP 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31253694/

相关文章:

php - 链接简历提交 HTML 表单以提交到 MySQL 数据库

PHP 从 mysql 结果设置为图表系列?

javascript - 自动缩放 DIV 元素并考虑页眉和页脚直到滚动

javascript - 如何将 <div> 转换为可折叠面板?

php - Symfony2 自引用多对多关系

css - 从 textarea 中删除所有样式(边框、发光)

php - 使用 PHP 的多部分表单数据。 (图片上传)

php - 这个查询有什么问题?语法错误

php - SQL 提交的正确语法

html - 更改默认显示属性是一种好习惯吗?