Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.

core/requestALB.go seem to be double escaping query string parameters #203

Open
choonkeat opened this issue Jul 10, 2024 · 3 comments
Open

Comments

@choonkeat
Copy link

In

for q, l := range req.MultiValueQueryStringParameters {
for _, v := range l {
if queryString != "" {
queryString += "&"
}
queryString += url.QueryEscape(q) + "=" + url.QueryEscape(v)
}

It would seem like the key and values in req.MultiValueQueryStringParameters are raw i.e. already query escaped

so it should be

- queryString += url.QueryEscape(q) + "=" + url.QueryEscape(v)
+ queryString += q + "=" + v

I'm not sure about QueryStringParameters

@choonkeat
Copy link
Author

related #147

@choonkeat
Copy link
Author

https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html

If you enable multi-value headers, the load balancer uses both cookies sent by the client and sends you an event that includes headers using multiValueHeaders. For example:

"multiValueHeaders": {
    "cookie": ["name1=value1", "name2=value2"],
    ...
},

If the query parameters are URL-encoded, the load balancer does not decode them. You must decode them in your Lambda function.

@alecava41
Copy link

https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html

If you enable multi-value headers, the load balancer uses both cookies sent by the client and sends you an event that includes headers using multiValueHeaders. For example:
"multiValueHeaders": {
"cookie": ["name1=value1", "name2=value2"],
...
},

If the query parameters are URL-encoded, the load balancer does not decode them. You must decode them in your Lambda function.

I don't get how the suggested solution could solve the problem, could you please elaborate further?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants