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

asked 5 years ago907 views
2 Answers
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
answered 5 years ago
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

answered 5 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions