We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0c82e1f commit 61fa598Copy full SHA for 61fa598
1 file changed
app/controllers/concerns/dynamic_content_security_policy.rb
@@ -68,8 +68,14 @@ def add_hocuspocus_host_to_csp
68
nil
69
end
70
if uri.present?
71
- append_content_security_policy_directives(connect_src: ["#{uri.scheme}://#{uri.host}"])
+ append_content_security_policy_directives(connect_src: ["#{uri.scheme}://#{host_with_port(uri)}"])
72
73
74
75
+
76
+ def host_with_port(uri)
77
+ # Include port if it's not the default port for the scheme (necessary for local dev support)
78
+ default_port = ["wss", "https"].include?(uri.scheme) ? 443 : 80
79
+ uri.port && uri.port != default_port ? "#{uri.host}:#{uri.port}" : uri.host
80
+ end
81
0 commit comments