Are get request with body allowed in AWS? 403 error

0

Hi,

I published an API to AWS with Visual Studio, for now I am testing the methods with postman, but all get methods that require a body are returning an error that mentions cloudfront in the response, I do not know if the issue is related to cloudfront or if is the AWS HTTP 1.1 specification implementation that does not allow get requests with body:

Note:Get request with body were a requirement from our client

this is the error:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <TITLE>ERROR: The request could not be satisfied</TITLE> </HEAD> <BODY> <H1>403 ERROR</H1> <H2>The request could not be satisfied.</H2> <HR noshade size="1px"> Bad request.
    <BR clear="all">  
    <HR noshade size="1px">  
    <PRE>  

Generated by cloudfront (CloudFront)

</PRE> <ADDRESS></ADDRESS> </BODY> </HTML>

RFC 7231 HTTP/1.1 specification says the following:
A payload within a GET request message has no defined semantics;
sending a payload body on a GET request might cause some existing
implementations to reject the request.

so my questions are:

  1. are get request with body allowed in AWS?
  2. how AWS deals with get request with body?
  3. is there a way to use get methods with body on AWS?

Many Thanks

已提问 5 年前930 查看次数
2 回答
1

CloudFront rejects a get request with body.
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/RequestAndResponseBehaviorCustomOrigin.html#RequestCustom-get-body

As noted in the RFC, this behavior might be different based on the implementations. With this reason, although RFC does not prohibit to use GET request with body, generally it is not encouraged to use it.

AWS
已回答 5 年前
0

Thanks for your answer @jwaataws, and I just have some doubts. I was researching that there are several types of API Gateway: Edge Optimized, Regional API Gateways and Private API Gateways. the regional API Gateway does not come with an implementation of cloudfront, so my questions are:

what would happen if I use regional API gateway without cloudfront?
would that allow me to make get Request with body?
or is it possible to have API Gateway without cloudfront configured and in that way allow get requests with body?

Many Thanks

Edited by: egzx73 on May 7, 2019 1:27 PM

已回答 5 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则

相关内容