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 committed by GitHub
parent 334ae5523e
commit 509774bcb4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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