diff --git a/zio-http/shared/src/main/scala/zio/http/internal/HeaderModifier.scala b/zio-http/shared/src/main/scala/zio/http/internal/HeaderModifier.scala index 255358d8c5..ea2ba32b05 100644 --- a/zio-http/shared/src/main/scala/zio/http/internal/HeaderModifier.scala +++ b/zio-http/shared/src/main/scala/zio/http/internal/HeaderModifier.scala @@ -32,7 +32,11 @@ import zio.http._ */ trait HeaderModifier[+A] { self => final def addHeader(header: Header): A = - addHeaders(Headers(header)) + if (header.headerName == Header.XFrameOptions.name) { + updateHeaders(headers => Headers(headers.filterNot(_.headerName == Header.XFrameOptions.name)) ++ Headers(header)) + } else { + addHeaders(Headers(header)) + } final def addHeader(name: CharSequence, value: CharSequence): A = addHeaders(Headers.apply(name, value))