Only allow iframes to be loaded from our domain
This commit is contained in:
parent
911c439858
commit
bae28c5f57
3 changed files with 78 additions and 1 deletions
|
@ -33,6 +33,13 @@ func (g DashboardHandler) Append(router *mux.Router) {
|
|||
Handler(http.StripPrefix("/dashboard/", http.FileServer(g.Assets)))
|
||||
}
|
||||
|
||||
func (g DashboardHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
// allow iframes from our domains only
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-src
|
||||
w.Header().Set("Content-Security-Policy", "frame-src 'self' https://traefik.io https://*.traefik.io;")
|
||||
http.FileServer(g.Assets).ServeHTTP(w, r)
|
||||
}
|
||||
|
||||
func safePrefix(req *http.Request) string {
|
||||
prefix := req.Header.Get("X-Forwarded-Prefix")
|
||||
if prefix == "" {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue