Merge pull request #82 from kevinmcconnell/script-cable-path

Allow serving cable traffic under `$SCRIPT_NAME`
This commit is contained in:
Kevin McConnell
2025-09-24 15:58:31 +01:00
committed by GitHub
2 changed files with 8 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
module CableHelper
def script_aware_action_cable_meta_tag
tag.meta \
name: "action-cable-url",
content: "#{request.script_name}#{ActionCable.server.config.mount_path}"
end
end

View File

@@ -12,6 +12,7 @@
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= current_user_meta_tags %>
<%= script_aware_action_cable_meta_tag %>
<%= tag.meta name: "vapid-public-key", content: Rails.configuration.x.vapid.public_key %>
<%= tag.meta name: "turbo-prefetch", content: "true" %>