-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: 프론트 새 도메인 CORS 설정 추가 #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Summary of ChangesHello @yeongsinkeem, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 프론트엔드 애플리케이션의 도메인 변경 사항을 반영하기 위해 CORS 구성을 업데이트합니다. 이를 통해 백엔드가 새로운 프론트엔드 배포와 교차 출처 리소스 공유 문제 없이 올바르게 통신할 수 있도록 보장합니다. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
안녕하세요. 프론트엔드 새 도메인 주소를 CORS 설정에 추가하는 변경사항을 확인했습니다.
한 가지 개선점을 제안합니다. CORS 출처 URL에 후행 슬래시가 있는 것과 없는 것이 모두 포함되어 있어 중복이 발생했습니다. 이 중 하나를 제거하여 설정을 더 깔끔하게 만들 수 있습니다.
또한, 장기적인 유지보수성을 위해 하드코딩된 URL 목록을 application.properties와 같은 설정 파일로 분리하는 것을 고려해보시면 좋을 것 같습니다. 자세한 내용은 각 파일의 주석을 참고해주세요.
| CorsConfiguration configuration = new CorsConfiguration(); | ||
| configuration.setAllowedOriginPatterns(Arrays.asList( | ||
| "http://localhost:3005", "https://frontend-tackit.vercel.app", "https://frontend-tackit.vercel.app/", | ||
| "http://localhost:3005", "https://frontend-tackit.vercel.app/", "https://frontend-tackit.vercel.app", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CORS 설정에 중복된 출처(origin)가 포함되어 있습니다. "https://frontend-tackit.vercel.app/"와 "https://frontend-tackit.vercel.app"은 사실상 동일한 출처로 처리되므로, 가독성과 유지보수성을 위해 후행 슬래시(/)가 없는 URL 하나만 남기는 것이 좋습니다.
| "http://localhost:3005", "https://frontend-tackit.vercel.app/", "https://frontend-tackit.vercel.app", | |
| "http://localhost:3005", "https://frontend-tackit.vercel.app", |
| configuration.setAllowedOriginPatterns(Arrays.asList( | ||
| "http://localhost:3005", "https://frontend-tackit.vercel.app", "https://frontend-tackit.vercel.app/", | ||
| "http://localhost:3005", "https://frontend-tackit.vercel.app/", "https://frontend-tackit.vercel.app", | ||
| "https://www.tackit.site" | ||
| )); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
허용된 CORS 출처가 코드에 하드코딩되어 있습니다. 향후 다른 환경(예: 스테이징)이 추가될 경우, 코드를 직접 수정하고 재배포해야 하는 번거로움이 있습니다. 이 값들을 application.properties 파일로 옮기고 @Value 어노테이션을 사용하여 주입받는 방식을 고려해보세요. 이렇게 하면 유연성이 크게 향상됩니다.
예시:
application.properties:
cors.allowed-origins=http://localhost:3005,https://frontend-tackit.vercel.app,https://www.tackit.siteSecurityConfig.java:
@Value("${cors.allowed-origins}")
private List<String> allowedOrigins;
@Bean
CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();
configuration.setAllowedOriginPatterns(allowedOrigins);
// ...
}
이슈 번호
작업 내용