반응형
[2022.10.13] How to solve error Access-Control-Allow-Origin on Ajax?
이번 게시글은 ajax에서 호출 할 때 발생하는 에러 메세지에 대해 해결하는 방법에 대해 알아보자.
require-jquery-2.1.4.js:10526 Access to XMLHttpRequest at 'http://localhost:xxxx/path' from origin 'http://local.xxxx.com:xxxx' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
POST http://localhost:xxxx/path net::ERR_FAILED 200
해결방법
1. api server (서버단)
@CrossOrigin("*")
@RequestMapping(value="path", method=RequestMethod.POST)
컨트롤러에서 @RequestMapping(value="path", method=RequestMethod.POST) 위에 @CrossOrigin("*") 을 추가
반응형
'prcExp' 카테고리의 다른 글
[2022.10.13] How to clear the image cache? (0) | 2022.10.13 |
---|---|
[2022.10.13] Linux Command (0) | 2022.10.13 |
[2022.10.13] How do I open an project new window on IntelliJ? (0) | 2022.10.13 |
[2022.10.13] How to import GitHub Repositories from IntelliJ? (0) | 2022.10.13 |
[2022.10.07] How to install Winscp on Mac? (0) | 2022.10.07 |
댓글