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 年前檢視次數 929 次
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 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南