Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
로그인 관련해서 CORS 문제가 발생해서 여러가지 방법을 모색해 봤지만, 결국 rewrite 기능을 이용하는게 가장 간단하고 좋은 방법인 것 같습니다. 하지만 rewrite로 Next.js 서버를 프록시처럼 이용하게 되면 불필요한 트래픽이 Next.js서버에 계속 걸리는 셈이 되므로 나중에 성능 최적화를 할 필요가 있을때 개선해야할 부분인 것 같습니다.
rewrite 적용 후 map.js 파일에서 axios 요청 관련 문제가 발생했는데, map.js 페이지는 SSR로 구현해서 브라우저 환경이 아닌 Node.js환경에서 axios 코드가 실행되는 바람에 rewrite가 적용되지 않아 발생하는 문제였습니다. 그래서 런타임 환경이 브라우저인지 체크하는 함수를 구현하고, 브라우저 환경이 아니라면 url을 바꿔주는 식으로 일단 해결했습니다.
아래는 주요 변경사항이니 확인 부탁드려요!