[erlang-questions] avoiding duplicate headers in cowboy

Garry Hodgson garry@REDACTED
Fri Dec 4 20:37:35 CET 2015


thanks for the pointers. our particular app is
pretty specific to our needs. but i always like to
study how other people have tackled similar problems.
there's so much to learn.


On 12/2/15 4:24 PM, Benoit Chesneau wrote:
> or https://github.com/benoitc/cowboy_revproxy ...
>
> On Wed, Dec 2, 2015 at 10:05 PM Geoff Cant <nem@REDACTED 
> <mailto:nem@REDACTED>> wrote:
>
>     Hi there, I’m sure you’re probably well along with your own code,
>     but you may be interested in similar work. Heroku recently
>     released Vegur - https://github.com/heroku/vegur which is the
>     HTTP/1.1 proxy library built on top of cowboy/ranch and used at
>     scale there. Fred and I both haunt this list if you have questions
>     about it. (It may be overkill, but if you need a lot of spec
>     compliance or are doing large scale proxying it is designed for
>     those things)
>
>     Cheers,
>     -Geoff
>
>     > On 1 Dec, 2015, at 10:38, Garry Hodgson <garry@REDACTED
>     <mailto:garry@REDACTED>> wrote:
>     >
>     > 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 127.0.0.1... connected
>     > * Connected to localhost (127.0.0.1) 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."
>     >
>     > _______________________________________________
>     > erlang-questions mailing list
>     > erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
>     > http://erlang.org/mailman/listinfo/erlang-questions
>
>     _______________________________________________
>     erlang-questions mailing list
>     erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
>     http://erlang.org/mailman/listinfo/erlang-questions
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20151204/41e689f9/attachment.htm>


More information about the erlang-questions mailing list