Skip to content

Conversation

@yeongsinkeem
Copy link
Collaborator

이슈 번호

X

작업 내용

  • 프론트 새 도메인 CORS 설정 추가

@yeongsinkeem yeongsinkeem merged commit 67c3595 into main Jan 13, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello @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(Cross-Origin Resource Sharing) 설정을 업데이트합니다. 이는 프론트엔드 서비스의 확장 또는 변경에 따라 필요한 조치입니다.

Highlights

  • CORS 설정 업데이트: 프론트엔드의 새로운 도메인 https://www.tackit.site에 대한 CORS 허용 패턴을 추가했습니다.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

이 PR은 CORS 설정을 수정하여 프론트엔드 새 도메인을 추가하는 것을 목적으로 하고 있습니다. 실제 변경 사항은 허용된 출처 목록의 순서를 변경한 것입니다.
코드 리뷰에서는 CORS 설정과 관련된 두 가지 개선 사항을 제안했습니다.

  1. Origin 헤더 표준에 따라 중복되고 불필요할 수 있는 URL(뒤에 /가 붙는)을 제거하여 설정을 명확히 할 것을 제안합니다.
  2. 유지보수성 향상을 위해 하드코딩된 URL 목록을 application.properties와 같은 외부 설정 파일로 옮기는 것을 권장합니다.

이러한 변경 사항을 적용하면 CORS 설정을 더 안전하고 유연하게 관리할 수 있을 것입니다.

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/",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

RFC 6454에 따르면 Origin 헤더는 스킴, 호스트, 포트로 구성되며 경로(path)를 포함하지 않습니다. 따라서 Origin 헤더 값은 https://frontend-tackit.vercel.app과 같은 형태이며, 일반적으로 마지막에 슬래시(/)가 붙지 않습니다.
"https://frontend-tackit.vercel.app/" 설정은 중복일 가능성이 높으므로, 제거하여 코드를 더 명확하게 하고 잠재적인 문제를 방지하는 것이 좋습니다.

Suggested change
"http://localhost:3005", "https://frontend-tackit.vercel.app", "https://frontend-tackit.vercel.app/",
"http://localhost:3005", "https://frontend-tackit.vercel.app",

Comment on lines 39 to 42
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"
));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

CORS 허용 출처(origin) 목록을 코드에 하드코딩하는 대신, application.properties 또는 application.yml 같은 외부 설정 파일로 분리하는 것을 고려해보세요. 이렇게 하면 애플리케이션을 다시 빌드하고 배포하지 않고도 허용 출처를 쉽게 변경할 수 있어 유연성과 유지보수성이 향상됩니다.

예를 들어, application.properties에 다음과 같이 설정할 수 있습니다:

cors.allowed-origins=http://localhost:3005,https://frontend-tackit.vercel.app,https://www.tackit.site

그리고 SecurityConfig 클래스에서 @Value 어노테이션을 사용하여 이 값을 주입받을 수 있습니다:

@Value("${cors.allowed-origins}")
private List<String> allowedOrigins;

// ...

@Bean
CorsConfigurationSource corsConfigurationSource() {
    CorsConfiguration configuration = new CorsConfiguration();
    configuration.setAllowedOriginPatterns(allowedOrigins);
    // ...
}

이렇게 하면 Arrays.asList() 호출 없이 더 깔끔하게 코드를 작성할 수 있습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants