[erlang-questions] cowboy etags problems

Garry Hodgson <>
Mon Jan 16 15:57:13 CET 2017


I have an application that acts as an http proxy, accepting REST api 
calls, forwarding to appropriate endpoints, and returning result. It's 
built atop Cowboy, and generally works well.

However, while exploring a reported bug I discovered that I was not 
handling etags properly. Whenever an if-match header was included, 
Cowboy returned a 400, before my code ever saw the request. I eventually 
discovered that I was being sent headers like: If-Match: 1234567

Instead of: If-Match: "1234567"

Digging into the RFC it appears that Cowboy is handling this properly, 
as the surrounding quotes are part of the spec. But it will still cause 
problems for my users.

When I pass the correct If-Match header, I get a 412 Precondition 
Failed. This also appears to be correct behavior, as my Cowboy instance 
doesn't have the etag, the eventual endpoint should. So I think what I 
really need to do is to turn off If-Match handling in Cowboy and just 
pass through the headers I get, or possibly intercept the request before 
Cowboy looks at this and massage the inputs/outputs.

Am I correct in this diagnosis? Is there any way to solve this? It's 
kind of a showstopper.

Any insights appreciated.

Thanks






More information about the erlang-questions mailing list