We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
When you run a Phoenix application in production, you might have encountered exceptions like:
** (Phoenix.NotAcceptableError) no supported media type in accept header Expected one of ["html"] but got the following formats: * "text/plain" with extensions: ["txt", "text"] To accept custom formats, register them under the :mime library in your config/config.exs file: config :mime, :types, %{ "application/xml" => ["xml"] } And then run `mix deps.clean --build mime` to force it to be recompiled.
Or:
** (Plug.CSRFProtection.InvalidCSRFTokenError) invalid CSRF (Cross Site Request Forgery) token, please make sure that: * The session cookie is being sent and session is loaded * The request include a valid '_csrf_token' param or 'x-csrf-token' header
Phoenix throws these exceptions when it protects you from invalid and potentially malicious requests. It's great that Phoenix protects us from such bad requests, but how can we make it a bit less noisy? Ideally, we would not receive exception alerts whenever a user makes a bad request.
continue reading on peterullrich.com
⚠️ This post links to an external website. ⚠️
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.