0
Fork 0
mirror of https://github.com/willnorris/imageproxy.git synced 2024-12-16 21:56:43 -05:00

Enable CORS for 3rd party applications

This commit is contained in:
Romanos 2017-06-20 18:24:55 +03:00 committed by Will Norris
parent d64b0f81c9
commit 50f6f640b2

View file

@ -150,6 +150,10 @@ func (p *Proxy) serveImage(w http.ResponseWriter, r *http.Request) {
}
copyHeader(w.Header(), resp.Header, "Content-Length", "Content-Type")
//Enable CORS for 3rd party applications
w.Header().Set("Access-Control-Allow-Origin", "*")
w.WriteHeader(resp.StatusCode)
io.Copy(w, resp.Body)
}