This distribution is not configured to allow the HTTP request

This distribution is not configured to allow the HTTP request

  1. Blog
  2. 15 November 2026
  3. 4 min read

Stefan Bogdanescu

Founder & Senior Architect

This distribution is not configured to allow the HTTP request

When you encounter the error message "This distribution is not configured to allow the HTTP request," it usually signals a misconfiguration in your web server's security settings rather than a bug in your application logic. The specific error text—"The distribution supports only cachable requests"—indicates that the server is enforcing a policy to serve only GET requests, blocking POST, PUT, or DELETE. This behavior is standard for CDN edge locations like Amazon CloudFront when they are configured to cache static assets but inadvertently intercept dynamic form submissions.

In your scenario, you have successfully secured your origin by forcing HTTPS via Amazon CloudFront. However, the issue arises specifically after a user submits your PHP login form. The form itself is correctly structured as a POST request:

<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">
    
    <div class="group">      
        <input type='text' class='form-control' name='email' required>
        <label>Email</label>
    </div>

    <div class="group">      
        <input type='password' class='form-control' name='pass' required>
        <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>
    <input type='submit' id='moreInfoButton' name='login' value='Continue' class='btn btn-danger'>                               
</form> 

Upon successful authentication in your PHP script, you redirect the user using a JavaScript window.open call:

if(isset($_POST['login'])){
    // [...] Authentication Logic
    echo "<script>window.open('coursePayment.php?crs_id=$crs_id','_self')</script>";
}

The error occurs because the browser attempts to fetch coursePayment.php?crs_id=... as a new navigation event triggered by the script. While this is technically a GET request, if your CloudFront distribution or the origin server (e.g., Amazon S3 or EC2) has strict caching rules applied globally, it might block requests that do not match specific cache headers, or it might be interpreting the context of the redirect as a non-cachable event. More commonly, if coursePayment.php is served from a location configured to only accept static content (like an S3 bucket with restrictive permissions), the server returns this error because dynamic PHP logic requires the server to process the request, which may not be allowed in that specific distribution configuration.

The root cause here is likely how CloudFront handles the OriginRequestPolicy. If your distribution is set up to cache everything aggressively, it might reject requests for files that do not have proper cache headers or are flagged as dynamic. Alternatively, if coursePayment.php resides on an origin (like S3) that you haven't configured with a Lambda@Edge function or a custom origin policy to handle PHP execution, the request fails at the edge.

To resolve this, you must ensure that the distribution allowing access to coursePayment.php is explicitly configured to allow non-cachable requests or dynamic processing. You can do this by updating the Cache Policy attached to the path /coursePayment.php. Create a new cache behavior that sets the TTL (Time To Live) to 0 for both Cache Hit and Miss, effectively disabling caching for this specific endpoint while allowing the request to pass through to your origin.

Additionally, verify that your OriginRequestPolicy allows the necessary headers. If you are using an S3 bucket as the origin, ensure that the bucket policy or the CloudFront distribution's CORS settings (if applicable) permit the POST method if the redirect logic eventually triggers a form submission on the payment page. However, since the redirect in your code uses window.open, it initiates a GET request to the URL with the query parameter. The error message implies the server thinks this specific GET is non-cachable or disallowed.

The most direct fix is to adjust the CloudFront distribution settings to allow caching for all origins or, conversely, explicitly exclude dynamic paths from restrictive "cachable only" policies. If you are using a static site host that does not support PHP directly (common with simple S3 setups), you cannot serve coursePayment.php unless you configure a Lambda function at the edge to proxy the request to your PHP backend, or move the file to an origin that supports dynamic scripting like EC2 or Elastic Beanstalk.

Ensure that the action='' attribute in your form points to the correct absolute URL or relative path that CloudFront can resolve without ambiguity. If the payment page is hosted on a different domain or subdomain with its own distribution, verify that the security groups and WAF rules on both ends allow the traffic. Misconfigured security groups often block outbound connections from the CDN edge if they are too restrictive, though this usually results in connection refused errors rather than "distribution not configured" errors.

By relaxing the cache policy for dynamic endpoints or ensuring your origin can handle the specific request method and headers required by the payment flow, you will eliminate the distribution restriction error and allow users to proceed seamlessly after login.

Our network