Fix embedding livebook inside iframe with LIVEBOOK_WITHIN_IFRAME (#3024)

This commit is contained in:
Jonatan Kłosko 2025-06-20 12:03:04 +02:00
parent 736abe31d7
commit b965d15dcc

View file

@ -178,7 +178,9 @@ defmodule LivebookWeb.Router do
defp within_iframe_secure_headers(conn, _opts) do
if Livebook.Config.within_iframe?() do
delete_resp_header(conn, "x-frame-options")
[value] = get_resp_header(conn, "content-security-policy")
value = String.replace(value, "frame-ancestors 'self';", "frame-ancestors *;")
put_resp_header(conn, "content-security-policy", value)
else
conn
end