So, there are several questions about StackOverflow addressed to this error, but from 10-15 I checked, I could not find a solution to my exact problem.
I am running an Angular application (port 9000) and a Rails application (port 3000) on a remote server. The Angular application sends requests to the rails application through an email request.
When the request is made, the Javascript console displays this error message:
XMLHttpRequest cannot load http://0.0.0.0:3000/api/query. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://10.241.16.159:9000' is therefore not allowed access.
From what I read, I need to change something in my Rails application so that it can accept connections from other servers (which seems strange because both applications are running on the same ec2 instance).
I tried to add a string like
skip_before_filter :verify_authenticity_token
for my controller in rails, but this does not seem to have an effect.
How can I solve this error?
source share