Ask A Question


You’re not receiving notifications from this thread.

Solving Active Storage InvalidAuthencityToken Error

Henry asked in Rails

I have an application which is on and i am trying to upload image using trix editor from my subdomain but for some reason i keep getting this error

Started POST "/rails/active_storage/direct_uploads" for at 2023-11-10 12:10:07 +0000
Processing by ActiveStorage::DirectUploadsController#create as JSON
  Parameters: {"blob"=>{"filename"=>"001.jpg", "content_type"=>"image/jpeg", "byte_size"=>101505, "checksum"=>"qEG2QTZafLMiMl/TXWy6cw=="}, "direct_upload"=>{"blob"=>{"filename"=>"001.jpg", "content_type"=>"image/jpeg", "byte_size"=>101505, "checksum"=>"qEG2QTZafLMiMl/TXWy6cw=="}}}
HTTP Origin header ( didn't match request.base_url (
Completed 422 Unprocessable Entity in 7ms (ActiveRecord: 0.0ms | Allocations: 807)

ActionController::InvalidAuthenticityToken (HTTP Origin header ( didn't match request.base_url (

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 79,047+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

    © 2023 GoRails, LLC. All rights reserved.