Allowing registered URL's only to connect to the socket

Hey,
I want to allow only URL’s that I specify to connect to the socket.
Right now this is what I’m doing, but I’m not sure if this is the best way. Any advice would be helpful.

In the dev.exs file:

config :chat, Chat.Endpoint,
  http: [port: 4000],
  debug_errors: true,
  code_reloader: true,
  check_origin: ["http://localhost:8888/water/", "http://localhost:3000/water/", "http://localhost:4000/"],
  watchers: [node: ["node_modules/brunch/bin/brunch", "watch", "--stdin",
                    cd: Path.expand("../", __DIR__)]]
1 Like

You could probably check the origin via the socket struct maybe? That way you could check based on connection and such.

1 Like