![[Java, 자바] Access-Control-Allow-Origin 두 개 포함 에러](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FN1STp%2FbtsH50qbJtt%2FJBreRqRAm4XTXTkbuA21Hk%2Fimg.png)
개발환경
Front : React
BackEnd : Spring Boot
ChatGptAPI : gpt-3.5-turbo
에러
GptAPI 사용 시 Front에서 Server로 데이터를 요쳥하고 있고 아래와 같이 코드를 작성하였을 때 분명 State값은 200으로 정상인데 Header에 Access-Control-Allow-Origin가 두 개가 포함되어 에러가 발생하였습니다.....
'/chat-gpt/send'로 데이터를 요청 시 아래와 같은 에러를 마주하였습니다.
해결방법
StackOverFlow를 찾아보던 중 동일한 사례를 발견하였습니다 !
참고 자료 :
Spring Boot - The 'Access-Control-Allow-Origin' header contains multiple values but expect only one
I read all posts on StackOverflow on this topic but did not find answer as they all are about difference scenario than mine. My spring boot API uses Spring Security and is accessed by Angular clien...
stackoverflow.com
이유는 ResponseEntity로 전달되는 exchange 객체에 Header가 포함되어 Header 설정이 두 번되었던 것이였습니다.....
데이터 응답 시 Header를 제외하고 전달하였더니 해결되었습니다 !
'Error' 카테고리의 다른 글
[Github, Git] 리포지토리 폴더 접속 안될 때 (2) | 2024.09.07 |
---|---|
[Error] MySQL net.sf.log4jdbc.sql.jdbcapi.DriverSpy claims to not accept jdbcUrl (0) | 2024.08.16 |
[Java, 자바] no main manifest attribute in 에러 (0) | 2024.05.01 |
[EKL] Elasticsearch Cors 해결 방법 (0) | 2024.04.23 |
[React] npm start, Proxy관련 오류 (0) | 2024.03.21 |
개발의 모든 것 !
포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!