Get actual request path in API Gateway HTTP API

1

The event payload v2.0 of an HTTP API contains a "rawPath" field. However, this does not contain the actual raw request path. It seems to go through some kind of normalization.

For example, a request such as: https://example.com//foo//bar will return "/foo/bar" without the excess slashes. I would like to be able to somehow retrieve that is was "//foo//bar" so I can issue a 301 redirect to the proper corrected path. Is there any trick to get this? Is this a bug?

I do notice that payload v1.0 returns the desired raw request at "path". However, I'd rather not go back to an older, possibly future deprecated version.

1 Answer
0

You can see from the Schema that it will not provide the Full URL: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format.

You can connect it to Lambda, print out the event and look at your cloudwatch logs to determine which of them provides the desired value.

AWS
vtjean
answered 3 months 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