question about httputil. NewSingleHostReverseProxy

76 views
Skip to first unread message

Vasiliy Tolstov

unread,
Oct 18, 2021, 4:14:31 PM10/18/21
to golan...@googlegroups.com
Hi. I'm use go reverse proxy in some project and have a question
https://cs.opensource.google/go/go/+/refs/tags/go1.17.2:src/net/http/httputil/reverseproxy.go;l=323
why headers when copied added to already written? Why copyHeader do
Add method for header and not Set ?
For example - I have middleware in http server that set some headers,
when in some http handler i'm use reverse proxy feature it add other
headers from upstream and i have duplicate headers. This is not so
bad, but in case of CORS - this breaks. So i need to cleanup headers
from upstream before run ServeHTTP from proxy handler.


--
Vasiliy Tolstov,
e-mail: v.to...@selfip.ru
Reply all
Reply to author
Forward
0 new messages