1
0
Fork 1
mirror of https://akkoma.dev/AkkomaGang/akkoma.git synced 2024-11-18 10:59:17 +00:00

Plugs.HTTPSecurityPlug: Activate upgrade-insecure-requests only when there is https

This fixes running mastofe with MIX_ENV=dev
This commit is contained in:
Haelwenn (lanodan) Monnier 2018-11-26 21:40:29 +01:00
parent 3370924b8b
commit 04daa0fa44
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE

View file

@ -29,6 +29,8 @@ defp headers do
end
defp csp_string do
protocol = Config.get([Pleroma.Web.Endpoint, :protocol])
[
"default-src 'none'",
"base-uri 'self'",
@ -40,7 +42,9 @@ defp csp_string do
"script-src 'self'",
"connect-src 'self' " <> String.replace(Pleroma.Web.Endpoint.static_url(), "http", "ws"),
"manifest-src 'self'",
if @protocol == "https" do
"upgrade-insecure-requests"
end
]
|> Enum.join("; ")
end