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:
- will these services clash if run them on same port?
- if have run on different domains, how do securely?
- how admins handle in production modes when servers going on different port/domain?
langley's second link turned great rails module manage cors.
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
Post a Comment