Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing raw url using AWS API Gateway

Is it possible to access the raw url using AWS API Gateway (and Lambda)?

Alternatively, is it possible to access the original, undecoded query string paramters?

We are integrating against a third party service, that calls our API and encodes the query string params from Windows-1252. (E.g. the finnish letter Ä is encoded as %C4 instead of %C3%84). API Gateway seems to automatically decode the query string parameters and assume UTF-8, which means, that Ä (and Ö and Å) result in \ufffd.

For reference: https://www.w3schools.com/tags/ref_urlencode.asp

like image 654
skoll Avatar asked Oct 12 '18 10:10

skoll


1 Answers

Damn, it really doesn't look possible...

I started off writing how you can use Lambda Proxy Integration with event.queryStringParameters, but that parses the data into a key-value object.

Then I went down the road of Mapping Templates in API Gateway, but again there doesn't seem to be any property that shows the whole querystring.

As much as I didn't want it to be true, I can only conclude that it is not possible...

I think your best option is to encode the parameter as base64 on the client, then decode in the Lambda function using Object.keys(event.queryStringParameters)[0].

like image 81
Matt D Avatar answered Nov 04 '22 11:11

Matt D