Explains a common Phoenix.Socket check_origin error that occurs when users access a site from an old or incorrect domain. The error happens because Phoenix validates WebSocket connections against the configured host to prevent Cross-site WebSocket Hijacking (CSWSH) attacks. The solution is implementing a redirect plug in the browser pipeline that automatically redirects users from old domains to the correct one, ensuring legitimate WebSocket connections are accepted.
Table of contents
Why is this even a thing?How do we keep stubbing our toes on this?Why does the phoenix.socket check_origin error happen?Sort: