Use url[:scheme] instead of protocol to determine if https is enabled
authorshibayashi <shibayashi@cypherpunk.observer>
Mon, 11 Feb 2019 23:08:52 +0000 (00:08 +0100)
committershibayashi <shibayashi@cypherpunk.observer>
Mon, 11 Feb 2019 23:08:52 +0000 (00:08 +0100)
lib/pleroma/plugs/http_security_plug.ex

index 2a266c407fb8131b03e0e323d67446f61a112551..3c8e6a18f730c709df59d6c2e3930cca06367f5b 100644 (file)
@@ -33,7 +33,7 @@ defmodule Pleroma.Plugs.HTTPSecurityPlug do
   end
 
   defp csp_string do
-    protocol = Config.get([Pleroma.Web.Endpoint, :protocol])
+    scheme = Config.get([Pleroma.Web.Endpoint, :url])[:scheme]
 
     [
       "default-src 'none'",
@@ -46,7 +46,7 @@ defmodule Pleroma.Plugs.HTTPSecurityPlug do
       "script-src 'self'",
       "connect-src 'self' " <> String.replace(Pleroma.Web.Endpoint.static_url(), "http", "ws"),
       "manifest-src 'self'",
-      if protocol == "https" do
+      if scheme == "https" do
         "upgrade-insecure-requests"
       end
     ]