angularjs - Angular2 and Rails backend integration -


i'm developing simple angular 2 app using angular2/http module access rails resource. i'm running both node development server , rails development server. issue i'm having getting around same origin policy restrictions on ajax call rails backend.

error:

xmlhttprequest cannot load http://localhost:3000/people. origin http://localhost:8080 not allowed access-control-allow-origin. 

my servers on

http://localhost:8080 //node http://localhost:3000 //rails 

i need clarification how works:

  1. will these services clash if run them on same port?
  2. if have run on different domains, how do securely?
  3. how admins handle in production modes when servers going on different port/domain?

langley's second link turned great rails module manage cors.

github rack-cors gem

simply include in gemfile , add following config/application.rb

config.middleware.insert_before 0, "rack::cors"   allow     origins '*'     resource '*', :headers => :any, :methods => [:get, :post, :options]   end end 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -