Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ion-provider should handle when the header has coll-of values. #3

Open
souenzzo opened this issue Mar 27, 2019 · 3 comments
Open

ion-provider should handle when the header has coll-of values. #3

souenzzo opened this issue Mar 27, 2019 · 3 comments
Assignees

Comments

@souenzzo
Copy link

Some middlewares¹ create headers values like {"Set-Cookie" ["foo"]}

On aws lambda, it results in

Endpoint response body before transformations: 
{
  ...pprinted and filtered the relevant content...
  "headers": {
    "Set-Cookie": [
      "foo"
    ]
  }
}

That throws:
Execution failed due to configuration error: Malformed Lambda proxy response

In aws docs², it shows in examples that headers should be a (s/map-of string? string?)

In the case of cookies, it can be (string/join ";" vs), but I dont know how "any many valued" header should be joined.

I can find how jetty handle it :/

¹ https://github.com/ring-clojure/ring/blob/master/ring-core/src/ring/middleware/cookies.clj#L142
² https://aws.amazon.com/premiumsupport/knowledge-center/malformed-502-api-gateway/

@ddeaguiar
Copy link
Contributor

ddeaguiar commented Apr 12, 2019

I dug into this and found that for servlets, Pedestal adds the header multiple times with each value, respectively. Additionally, the AWS API Gateway documentation supports passing multiple values for a header using the multiValueHeaders key in responses. This ends up adding the header multiple times for each value as well.

I'll look into how multiValueHeaders can be supported but think that will involve a change to Datomic Ions web support.

@ddeaguiar ddeaguiar self-assigned this Apr 12, 2019
@euccastro
Copy link

See this for a slightly hacky workaround to this problem https://github.com/euccastro/expand-headers .

@yayitswei
Copy link

Can confirm @euccastro's workaround solves the issue when using API Gateway.

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

No branches or pull requests

4 participants