Please i’m having issue getting samly (https://github.com/handnot2/samly) to work on production everything works fine on dev but i get error 502 bad request error with distillery build.
After using curl to call the endpoint i found out that cowboy could not process the request to the error:
malformed request, a Poison.SyntaxError exception was raised with message "Unexpected token at position 1:"
<h5 class="struct">
Plug.Parsers.ParseError
<small>at POST</small>
<small class="path">/sso/auth/signin/entidp</small>
</h5>
<h1 class="title">malformed request, a Poison.SyntaxError exception was raised with message "Unexpected token at position 1: "</h1>
As a very blind guess, I’d say Poison receives a JSON document that is BOM’d and can’t deal with it. But as you say its working from dev, I’m wondering where this BOM would have been inserted…
Can you log and inspect the JSON you want to parse? Or please check if the first bytes in the response body are one of those in this table:
If so, a function like the following should be able to strip them: