After configuring a whole site CDN on CloudFront, you receive the following error.
Click on the arrows to vote for the correct answer
A. B. C. D.Answer - B.
The AWS documentation also states that "CloudFront caches responses to GET and HEAD requests" and, optionally, OPTIONS requests.
CloudFront does not cache responses to requests that use the other methods.
As per AWS documentation,
Allowed HTTP Methods.
Specify the HTTP methods that you want CloudFront to process and forward to your origin:
GET, HEAD: You can use CloudFront only to get objects from your origin or to get object headers.
GET, HEAD, OPTIONS: You can use CloudFront only to get objects from your origin, get object headers, or retrieve a list of the options that your origin server supports.
GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE: You can use CloudFront to get, add, update, and delete objects, and to get object headers.
In addition, you can perform other POST operations, such as submitting data from a web form.
Note:
CloudFront caches responses to GET and HEAD requests and, optionally, OPTIONS requests.
CloudFront does not cache responses to requests that use the other methods.
Based on this, Option B seems to be a better choice than.
C.For more information, please visit:
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesAllowedHTTPMethodsWhen the CloudFront Distribution supports only "cacheable requests", it means that it supports only GET and HEAD HTTP requests (read-only)
For the HTTP requests such as OPTIONS, PUT, POST, PATCH AND DELETE, the CloudFront will give an error "The distribution supports only cacheable requests".
Hence, option B is the correct answer.
There is a good question posted on StackOverflow which explains what should be done in this situation.
http://stackoverflow.com/questions/31253694/this-distribution-is-not-configured-to-allow-the-http-requestThe error indicates that there is a problem with the allowed HTTP methods on the specific origin configured for the CloudFront distribution. The allowed HTTP methods on the origin do not match the HTTP methods used by the client, which results in the error.
Option A, "The CloudFront distribution is configured to the wrong origin," is not likely to be the issue because the error message specifically mentions HTTP methods.
Option B, "Allowed HTTP methods on that specific origin is only accepting GET, HEA," is also not correct because "HEA" is not a valid HTTP method. The correct method is "HEAD."
Option C, "Allowed HTTP methods on that specific origin is only accepting POST, PATCH," is also not correct because the error message suggests that the client is using a method that is not allowed by the origin, and POST and PATCH are commonly used methods that are allowed by most origins.
Option D, "Allowed HTTP methods on that specific origin is only accepting GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE," is the correct answer because it lists all of the commonly used HTTP methods that are allowed by most origins. If the origin is only accepting a subset of these methods, then the client may receive an error if it attempts to use a method that is not allowed.
In summary, the correct answer is option D because it correctly identifies the allowed HTTP methods on the origin as the likely cause of the error.