프로그램/script

mobile app개발시 cors enable , same origin policy 극복하기

mulderu 2017. 12. 4. 11:03


mobile api를 개발하거나, json api proxy가 필요한경우 고민하지 말고 아래의 솔루션을 이용하자.


 $ sudo npm install -g cors-proxy-server

Password:

/usr/local/bin/cors-proxy-server -> /usr/local/lib/node_modules/cors-proxy-server/index.js

+ cors-proxy-server@1.0.2

added 5 packages in 2.018s

 $  

 $ cors-proxy-server 

[Mon Dec 04 2017 10:56:56 GMT+0900 (KST)] - CORS Proxy Server started on 0.0.0.0:9090


이제 아래와 같이 접속 어디든 접속 가능하다.


  • http://localhost:9090/ - server usage and help
  • http://localhost:9090/http://google.com/ - Google.com with CORS headers
  • http://localhost:9090/https://salesforce.com/ - Access Salesforce with CORS headers

 

git 주소 : https://github.com/antonioaguilar/cors-proxy-server