After extensive research on StackOverflow, I have not been able to find a solution to my specific issue among the several questions addressing similar errors.
The scenario involves running an Angular app (port 9000) and a Rails app (port 3000) on a remote server. The Angular app makes post requests to the Rails app.
Upon sending a request, the Javascript console displays the following 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.
Based on my understanding, I need to modify something in my Rails app to enable connections from other servers (even though both are on the same ec2 instance).
I attempted to add a line like
skip_before_filter :verify_authenticity_token
To one of my controllers in Rails, but it did not resolve the issue.
What steps should I take to fix this error?