Hi, I have a question about Sockets/Channels but couldn’t find an answer (sorry if duplicate)
I’m trying to check the origin of the socket connection. I want to limit who can use a specific channel based on their URL address (URL is not static). I’m building a Socket API of sort for live chat and want to limit chat usage for a specific customer.
EDIT: Nope, not it…
Okay, I found a solution! (after asking ChatGPT )
When configuring socket in endpoint, just add
:uri and it will pass URI data to socket
Hey @regex.sh can you show your solution in code? I’m also super curious if you can share your chat GPT session, I think some examples of people using it for Elixir would be super cool!
I deleted ChatGPT session because it wasn’t what I asked for (but I still wouldn’t feel comfortable sharing my terrible prompting with the world )
I still can’t find Phoenix native solution for this problem.
I “fixed” the problem with Nginx and
proxy_set_header X-Http-Origin $http_origin;
connect_info: [:x_headers, session: @session_options]