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:
parent
d64b0f81c9
commit
50f6f640b2
1 changed files with 4 additions and 0 deletions
|
@ -150,6 +150,10 @@ func (p *Proxy) serveImage(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
copyHeader(w.Header(), resp.Header, "Content-Length", "Content-Type")
|
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)
|
w.WriteHeader(resp.StatusCode)
|
||||||
io.Copy(w, resp.Body)
|
io.Copy(w, resp.Body)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue