-
Notifications
You must be signed in to change notification settings - Fork 376
Description
This was an issue originally raised here: awslabs/aws-lambda-web-adapter#99. Since the root issue is not in that project but this one I'm moving discussion here.
Problem: Whenever a url that contains a querystring with percent encoded values is passed through lambda-http, it gets double encoded in the newly generated http request if the original event source was an ALB. This is because the Lambda Event for ALBs does not automatically decode querystrings, whereas the same event for API Gateways do:
https://serverless-training.com/articles/api-gateway-vs-application-load-balancer-technical-details/ (about half way down the page)
Note that the keys and values of evt.queryStringParameters will be:
- already URL decoded for you on API Gateway. e.g. ?foo%5Ba%5D=foo%5B will be { 'foo[a]': [ 'foo[' ] }
- but not URL decoded on ALB. e.g. ?foo%5Ba%5D=foo%5B will be { 'foo%5Ba%5D': [ 'foo%5B' ] }
Discussion on the original issue lead to the thought that this difference should be handled here (but currently is not):
Some((&alb.multi_value_query_string_parameters, &alb.query_string_parameters)), |
Here is an example of a url that triggers this issue:
https://test.com/?originalQueryString=%3FshowAll%3Dtrue
When passed from an API Gateway the url passes through correctly:
https://test.com/?originalQueryString=%3FshowAll%3Dtrue
But if the original source was an ALB you get this instead:
https://test.com/?originalQueryString=%253FshowAll%253Dtrue
Thanks in advance.