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
preguntada hace 4 meses150 visualizaciones
1 Respuesta
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
respondido hace 3 meses

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas