File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -6,14 +6,19 @@ defmodule EpochtalkServerWeb.Endpoint do
66 plug RemoteIp
77
88 # cors configuration
9- corsica_config = Application . get_env ( :epochtalk_server , :corsica )
109 plug Corsica ,
11- origins: corsica_config . origins ,
10+ origins: { __MODULE__ , :valid_origin? , [ ] } ,
1211 allow_headers: :all ,
1312 allow_credentials: false ,
1413 allow_private_network: true ,
1514 expose_headers: [ "epoch-viewer" , "api-key" , "x-api-key" ]
1615
16+ def valid_origin? ( conn , _origin ) do
17+ origins = Application . get_env ( :epochtalk_server , :corsica ) . origins
18+ options = % Corsica.Options { origins: origins }
19+ Corsica . allowed_origin? ( conn , options )
20+ end
21+
1722 socket "/socket" , EpochtalkServerWeb.UserSocket ,
1823 websocket: true ,
1924 longpoll: false
You can’t perform that action at this time.
0 commit comments