Skip to content

Commit

Permalink
fix: fix wss connect by adding check_origin config
Browse files Browse the repository at this point in the history
  • Loading branch information
meagharty committed Aug 6, 2024
1 parent c007680 commit 2593fa6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions config/prod.exs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ import Config
config :arrow,
shape_storage_enabled?: true

config :arrow, :websocket_check_origin, [
"https://*.mbta.com",
"https://*.mbtace.com"
]

config :arrow, ArrowWeb.Endpoint,
http: [:inet6, port: 4000],
url: [host: "example.com", port: 80],
Expand Down
7 changes: 5 additions & 2 deletions lib/arrow_web/endpoint.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ defmodule ArrowWeb.Endpoint do
]

socket "/socket", ArrowWeb.UserSocket,
websocket: true,
websocket: [check_origin: Application.compile_env(:arrow, :websocket_check_origin, false)],
longpoll: false

socket "/live", Phoenix.LiveView.Socket,
websocket: [connect_info: [session: @session_options]],
websocket: [
connect_info: [session: @session_options],
check_origin: Application.compile_env(:arrow, :websocket_check_origin, false)
],
longpoll: [connect_info: [session: @session_options]]

# Serve at "/" the static files from "priv/static" directory.
Expand Down

0 comments on commit 2593fa6

Please sign in to comment.