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回答
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
回答済み 4ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ