victor23k
Proposal
I propose to add the Plug.Conn struct available inside the MFA configured for Phoenix.Endpoint.socket/3 under check_origin.
Benefits
This would make possible to use url params or headers to check if the origin is allowed. Example: passing a user_id param in the url, then checking somewhere else if the Origin is allowed by that user.
Changes
The actual change seems quite simple as conn is already present when the MFA is applied so. It would just need tests and modifying the documentation.
https://github.com/phoenixframework/phoenix/blob/83e4b3245f7cdc85b6c562860477500db9c72697/lib/phoenix/socket/transport.ex#L583-L584
I would be more than happy to send the PR.
Trending in Proposals: Ideas
We are seeing a lot of warning logs like this:
navigate event to "https://someurl" failed because you are redirecting across live_sessio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 2- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
steffend
Hey @victor23k,
the issue with the proposal is that any change to the arguments here would be a breaking change. So it’s not something we can easily do.
An ugly solution if you need this could be to have a plug before the socket and store data you need in the process dictionary and then access it from there later.
victor23k
You are right. Thanks for the workaround!