No 'Access-Control-Allow-Origin' header is present on the requested resource.




XMLHttpRequest 를 이용하여 다른 도메인의 서비스를 호출하면 아래와 같은 오류를 직면하게 된다.








XMLHttpRequest cannot load http://example.com/login. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.







web.xml 에 아래와 같이 필터를 추가하면 개발단계에서는 오류 해결은 가능. 운영 시에는 옵션 조정이 필요할 듯 하다.



















출처:

http://tomcat.apache.org/tomcat-7.0-doc/config/filter.html#CORS_Filter


댓글

가장 많이 본 글