Add csp
This commit is contained in:
parent
82ca7a6470
commit
9d83a1e23f
1 changed files with 5 additions and 0 deletions
|
@ -251,6 +251,7 @@ defmodule Pleroma.ReverseProxy do
|
||||||
|> Enum.filter(fn {k, _} -> k in @keep_resp_headers end)
|
|> Enum.filter(fn {k, _} -> k in @keep_resp_headers end)
|
||||||
|> build_resp_cache_headers(opts)
|
|> build_resp_cache_headers(opts)
|
||||||
|> build_resp_content_disposition_header(opts)
|
|> build_resp_content_disposition_header(opts)
|
||||||
|
|> build_csp_headers()
|
||||||
|> Keyword.merge(Keyword.get(opts, :resp_headers, []))
|
|> Keyword.merge(Keyword.get(opts, :resp_headers, []))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -316,6 +317,10 @@ defmodule Pleroma.ReverseProxy do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp build_csp_headers(headers) do
|
||||||
|
List.keystore(headers, "content-security-policy", 0, {"content-security-policy", "sandbox"})
|
||||||
|
end
|
||||||
|
|
||||||
defp header_length_constraint(headers, limit) when is_integer(limit) and limit > 0 do
|
defp header_length_constraint(headers, limit) when is_integer(limit) and limit > 0 do
|
||||||
with {_, size} <- List.keyfind(headers, "content-length", 0),
|
with {_, size} <- List.keyfind(headers, "content-length", 0),
|
||||||
{size, _} <- Integer.parse(size),
|
{size, _} <- Integer.parse(size),
|
||||||
|
|
Loading…
Reference in a new issue