We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d51155d commit b64d78fCopy full SHA for b64d78f
apps/api/lib/api_web/endpoint.ex
@@ -43,6 +43,7 @@ defmodule ApiWeb.Endpoint do
43
plug Plug.MethodOverride
44
plug Plug.Head
45
plug ApiWeb.Plugs.MetricsExporter
46
+ plug ApiWeb.Plugs.SecureHeaders
47
48
# The session will be stored in the cookie and signed,
49
# this means its contents can be read but not tampered with.
apps/api/lib/api_web/plugs/secure_headers.ex
@@ -0,0 +1,11 @@
1
+defmodule ApiWeb.Plugs.SecureHeaders do
2
+ import Plug.Conn
3
+
4
+ def init(opts), do: opts
5
6
+ def call(conn, _opts) do
7
+ conn
8
+ |> put_resp_header("x-frame-options", "ALLOW-FROM #{Core.url("/")}")
9
+ |> put_resp_header("content-security-policy", "frame-ancestors #{Core.url("/")};")
10
+ end
11
+end
0 commit comments