[erlang-questions] avoiding duplicate headers in cowboy

Garry Hodgson garry@REDACTED
Tue Dec 1 19:38:46 CET 2015

I've got an application where I'm using cowboy to build what is,
in effect, a web proxy. It accepts http/s requests, makes some
decisions about whether and where to forward, then makes its
own request of the final endpoint and returns results. it was
originally written in webmachine and then ported to cowboy.

everything works fine, but for one small nit. it appears that
cowboy automagically adds its own headers to the returned
results, which causes duplicate headers for server, content-type,
and content-length, as seen below.

is there some way to avoid this?

$ curl -X GET http://localhost:8080/v0/log/logs?maxrecords=1 -k -H 
"$Creds"  -v
* About to connect() to localhost port 8080 (#0)
*   Trying connected
* Connected to localhost ( port 8080 (#0)
 > GET /v0/log/logs?maxrecords=1 HTTP/1.1
 > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 
NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
 > Host: localhost:8080
 > Accept: */*
 > Authorization:  Bearer bc18fb0f-4b1f-493e-823c-fbefa0383e91
< HTTP/1.1 200 OK
< connection: keep-alive
< server: Cowboy
< date: Tue, 01 Dec 2015 17:34:29 GMT
< content-length: 71
< content-type: application/json
< connection: Keep-Alive
< date: Tue, 01 Dec 2015 17:34:30 GMT
< server: AT&T SECWEB 2.1.0
< content-length: 71
< content-type: application/json
< x-powered-by: PHP/5.4.28
< keep-alive: timeout=5, max=100
* Connection #0 to host localhost left intact
* Closing connection #0
{"error":"Not found","error_description":"Could not read token in CTS"}

Garry Hodgson
Lead Member of Technical Staff
AT&T Chief Security Office (CSO)

"This e-mail and any files transmitted with it are AT&T property, are confidential, and are intended solely for the use of the individual or entity to whom this e-mail is addressed. If you are not one of the named recipient(s) or otherwise have reason to believe that you have received this message in error, please notify the sender and delete this message immediately from your computer. Any other use, retention, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited."

More information about the erlang-questions mailing list