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.

gpoitch
已提問 4 個月前檢視次數 150 次
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
已回答 3 個月前

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

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

回答問題指南