Conversation
- ALB νλ‘μ ν€λ μ²λ¦¬ μ€μ μΆκ° - μΉ΄μΉ΄μ€ OAuth 리λ€μ΄λ νΈ URI HTTPSλ‘ λ³κ²½ - CORSμ νλ‘ νΈμλ HTTPS λλ©μΈ μΆκ° - Amplify λλ©μΈ ν¨ν΄ μΆκ°"
WalkthroughCORS νμ© μ€λ¦¬μ§ λͺ©λ‘μ΄ νμ₯λμκ³ , OAuth2 Kakao 리λλ μ URIκ° λλ©μΈ κΈ°λ° HTTPS μ£Όμλ‘ λ³κ²½λμμ΅λλ€. λν Tomcat 리λλ μ κ΄λ ¨ μλ² μμ±μ΄ μΆκ° λ° μμ λμμ΅λλ€. κ³΅κ° μν°ν° μκ·Έλμ²λ μΈλΆ APIμλ λ³νκ° μμ΅λλ€. Changes
Possibly related PRs
β¨ Finishing Touches
πͺ§ TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
π§Ή Nitpick comments (2)
SpringBoot/src/main/resources/application.properties (1)
87-88: Tomcat redirect μ΅μ βμλ/μ λ URI νΌμ© μν
server.tomcat.redirect-context-root=false
server.tomcat.use-relative-redirects=trueλ μ΅μ μ λμμ νμ±ννλ©΄ λ€μ μν₯μ΄ μμ΅λλ€.
- μ± λ΄λΆμμ
sendRedirect("/")κ°μ μ λ path λ₯Ό νΈμΆν κ²½μ°,Location: /(μλ) λ‘ λ΄λ €κ°λλ€. ALB λ€λΌλ©΄ μλν HTTPS λλ©μΈμ λΈλΌμ°μ κ° κ·Έλλ‘ μ¬μ©νλ―λ‘ μ₯μ μ΄ μμ§λ§,- μΈλΆ λλ©μΈμΌλ‘μ redirect(μ: Swagger UI Oauth2 flow) λ μλ-URI λ‘ μ νλλ©΄μ μ€λ₯κ° λ μ μμ΅λλ€.
μ΄μ νκ²½ μ λ°μμ μλ redirect λ§μΌλ‘ μΆ©λΆνμ§ νμΈμ΄ νμν©λλ€. νΉμ path redirect κ° μλ€λ©΄ μ λ URI μ μ§κ° μμ ν μ μμΌλ μ¬κ²ν κΆμ₯λ립λλ€.
SpringBoot/src/main/java/Baemin/News_Deliver/SecurityConfig.java (1)
128-138: CORS νμ© λλ©μΈ νλμ½λ©βμ μ§λ³΄μ λ° λ³΄μ μΈ‘λ©΄ κ°μ μ μλ³κ²½ μ체(μ κ· λλ©μΈ 3μ’ μΆκ°)λ νλΉν©λλ€. λ€λ§:
- ν¨ν΄
"https://*.amplifyapp.com"μ Spring 5.3 / Boot 2.7 μ΄μμμλ§ λ§€μΉλ©λλ€. νμ λ²μ μ΄λ©΄ 무μλλ νμ¬ λ°νμ λ²μ μ λ€μ νμΈν΄ μ£ΌμΈμ.configuration.setAllowCredentials(true)λ₯Ό μ¬μ©νλ©΄μ μμΌλμΉ΄λ ν¨ν΄μ νμ©νλ©΄ λΈλΌμ°μ μ€νμ λ¬Έμ λ μμ§λ§, λλ©μΈ μ€νΈν μνμ ν€μΈ μ μμ΅λλ€. Amplify μ±λ³λ‘ μλΈλλ©μΈμ μ νμ μΌλ‘ λͺ μνκ±°λ, λ°°ν¬ νAccess-Control-Allow-Originν€λκ° μμμΉ μκ²nullλ‘ λ¨μ΄μ§μ§ μλμ§ μ κ²μ΄ νμν©λλ€.- μ°¨ν λλ©μΈ λ³κ²½ μ μ½λλ₯Ό μμ Β·λ°°ν¬ν΄μΌ νλ―λ‘,
application.yamlλ‘ λͺ©λ‘μ μΈλΆννκ±°λ@Valueμ£Όμ νsplit(",")λ‘ μ²λ¦¬νλ λ°©μμ΄ μ μ§λ³΄μμ μ 리ν©λλ€.μμ 리ν©ν°λ§:
-configuration.setAllowedOriginPatterns(Arrays.asList( - "https://likelionnews.click", - ... -)); +configuration.setAllowedOriginPatterns( + Arrays.asList(corsAllowedOrigins.split(",")));application.properties:
cors.allowed-origins=https://likelionnews.click,...
π Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
π Files selected for processing (2)
SpringBoot/src/main/java/Baemin/News_Deliver/SecurityConfig.java(1 hunks)SpringBoot/src/main/resources/application.properties(2 hunks)
π Additional comments (1)
SpringBoot/src/main/resources/application.properties (1)
47-47: μΉ΄μΉ΄μ€ Redirect URI λ³κ²½βμ΄μ/κ°λ° μ½μ λͺ¨λ λ°λμ λκΈ°ν νμ
https://api.likelionnews.click/login/oauth2/code/kakaoλ‘ μμ νμ ¨λλ°,
- μΉ΄μΉ΄μ€ κ°λ°μ μ½μμ Redirect URI λͺ©λ‘μ λμΌν κ°μ΄ μΆκ°-μΉμΈλΌ μμ΄μΌ ν©λλ€.
- ALB β EC2 ꡬκ°μ΄ HTTP(80)μΈ κ²½μ°,
X-Forwarded-Protoν€λκ° HTTPS λ‘ μ λ¬λΌμΌ Spring Security κ° μ λ URI 리λ€μ΄λ νΈλ₯Ό μ¬λ°λ₯΄κ² κ³μ°ν©λλ€. μ΄λ―Έserver.forward-headers-strategy=frameworkλ₯Ό μΌμ ¨μ§λ§, Nginx / ALB μͺ½μX-Forwarded-*ν€λ μ κ±° μ μ± μ΄ μλμ§ νλ² λ νμΈν΄ μ£ΌμΈμ.
λ¬Έμνλ§ λμ΄ μμΌλ©΄ LGTM μ λλ€.
π§ HTTPS ALB μ€μ λ° νλ‘λμ λλ©μΈ μ ν
κ°μ
AWS ALB(Application Load Balancer)λ₯Ό ν΅ν HTTPS μ ν λ° νλ‘λμ λλ©μΈ μ€μ μ μν λ°±μλ κ΅¬μ± λ³κ²½μ λλ€.
λ³κ²½ μ¬ν
μΈνλΌ λ³κ²½μ¬ν
api.likelionnews.clickμ¬μ©μμ λ νμΌλ€
SpringBoot/src/main/resources/application.propertiesSpringBoot/src/main/java/Baemin/News_Deliver/SecurityConfig.javaμμΈ λ³κ²½λ΄μ©
application.properties μ€μ μΆκ°
SecurityConfig.java - CORS λλ©μΈ μΆκ°
μν€ν μ² νλ‘μ°
λ³κ²½ μ (HTTP)
λ³κ²½ ν (HTTPS)
λλ©μΈ ꡬ쑰
likelionnews.click(AWS Amplify)api.likelionnews.click(AWS ALB β EC2)ν μ€νΈ 체ν¬λ¦¬μ€νΈ
λ°°ν¬ μ ν μ€νΈ
λ°°ν¬ ν ν μ€νΈ
https://api.likelionnews.click/api/auth/statushttp://api.likelionnews.clickν μ€νΈ λͺ λ Ήμ΄
λ‘€λ°± κ³ν
λ¬Έμ λ°μ μ μ¦μ μ΄μ 컀λ°μΌλ‘ λ‘€λ°± κ°λ₯:
git reset --hard HEAD~1 git push --force origin master docker-compose down && docker-compose up -d --buildκ΄λ ¨ μΈνλΌ κ΅¬μ±
likelionnews-alblikelionnews-backendapi.likelionnews.clickapi.likelionnews.clickβ ALBμ¬μ μλ£ μμ
λ¨Έμ§ ν μμ μμ
REACT_APP_API_URL)κΈ°λ ν¨κ³Ό
Summary by CodeRabbit
μλ‘μ΄ κΈ°λ₯
λ²κ·Έ μμ
κΈ°ν μμ