Skip to content

Comments

[HOTFIX-#169] - nginx 설정에서 HTTP/2 프로토콜로 변경 및 프록시 헤더 추가#170

Merged
alsgud8311 merged 1 commit intodevelopmentfrom
fix/#169
Sep 20, 2025
Merged

[HOTFIX-#169] - nginx 설정에서 HTTP/2 프로토콜로 변경 및 프록시 헤더 추가#170
alsgud8311 merged 1 commit intodevelopmentfrom
fix/#169

Conversation

@alsgud8311
Copy link
Contributor

[HOTFIX-#169] - nginx 설정에서 HTTP/2 프로토콜로 변경 및 프록시 헤더 추가

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @alsgud8311, 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은 Nginx 프로덕션 설정에 대한 긴급 수정으로, 웹 서버의 통신 프로토콜을 HTTP/1.1에서 HTTP/2로 업그레이드하고, 프록시된 요청에 대한 중요한 클라이언트 정보를 전달하는 데 필요한 추가 X-Forwarded-* 헤더를 포함하도록 구성했습니다. 이는 서비스의 성능과 안정성을 향상시키고, 백엔드 애플리케이션이 클라이언트의 실제 요청 정보를 정확하게 파악할 수 있도록 돕습니다.

Highlights

  • Nginx HTTP/2 프로토콜 전환: Nginx 프록시 설정에서 HTTP/1.1을 HTTP/2로 변경하여 성능 및 효율성을 개선했습니다.
  • 프록시 헤더 추가: 요청의 원본 정보를 정확하게 전달하기 위해 X-Forwarded-For, X-Forwarded-Proto, X-Forwarded-Host, X-Forwarded-Port 헤더를 추가했습니다.
  • 불필요한 헤더 제거: HTTP/2 전환에 따라 더 이상 필요 없는 Upgrade 및 Connection 헤더를 제거했습니다.
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

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.

@alsgud8311 alsgud8311 merged commit d57223d into development Sep 20, 2025
4 checks passed
Copy link
Contributor

@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

안녕하세요. Nginx 설정 변경에 대한 리뷰입니다.

이번 PR은 nginx.prod.conf에서 HTTP/2를 사용하도록 프로토콜 버전을 변경하고 프록시 헤더를 추가하는 것을 목표로 하고 있습니다. 주요 변경 사항에 대해 몇 가지 중요한 검토 의견을 드립니다.

  1. 업스트림 서버의 HTTP/2 지원 여부: proxy_http_version2.0으로 변경하셨는데, 이는 프록시 대상인 Next.js 서버가 HTTP/2를 지원해야만 정상 동작합니다. 기본 Next.js 서버는 HTTP/1.1만 지원하므로, 이 변경으로 인해 서비스 장애가 발생할 수 있습니다. 이 부분은 반드시 확인이 필요합니다.
  2. WebSocket 설정 제거: HTTP/2로 변경하면서 WebSocket 관련 헤더(Upgrade, Connection)가 제거되었습니다. 만약 업스트림 서버가 HTTP/2를 지원하지 않아 HTTP/1.1로 설정을 되돌려야 하고, 애플리케이션이 WebSocket을 사용한다면 이 기능이 동작하지 않게 됩니다.
  3. 개발 환경 설정 불일치: nginx.prod.conf 파일만 수정되고 nginx.dev.conf는 변경되지 않았습니다. 이는 개발 환경과 운영 환경 간의 설정 차이를 유발하여 나중에 예기치 않은 문제를 일으킬 수 있습니다. 가능하면 두 환경의 설정을 일치시키는 것을 권장합니다.

자세한 내용은 각 파일의 코드 라인에 남긴 코멘트를 참고해주세요.

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_http_version 2.0;
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

proxy_http_version2.0으로 설정하면 프록시 대상인 업스트림 서버(next-server)가 HTTP/2를 지원해야 합니다. 현재 client:3000으로 설정된 Next.js 애플리케이션은 기본적으로 HTTP/1.1만 지원하므로, 이 설정은 연결 오류를 유발할 수 있습니다. 업스트림 서버가 HTTP/2를 지원하는지 확인하고, 그렇지 않다면 1.1로 되돌리는 것이 안전합니다.

            proxy_http_version 1.1;

Comment on lines 45 to 54
location / {
proxy_pass http://next-server/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_http_version 2.0;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

WebSocket 지원에 필요한 UpgradeConnection 헤더 설정이 제거되었습니다. proxy_http_version2.0으로 변경하면서 함께 제거하신 것으로 보입니다. 하지만 이전 코멘트에서 언급했듯이 업스트림 서버가 HTTP/1.1만 지원할 가능성이 높습니다. 이 경우 proxy_http_version1.1로 되돌려야 하며, 만약 애플리케이션에서 WebSocket을 사용한다면 UpgradeConnection 헤더도 다시 추가해야 합니다. 애플리케이션의 WebSocket 사용 여부를 확인하고 필요 시 관련 설정을 복원해주세요.

alsgud8311 added a commit that referenced this pull request Sep 20, 2025
[HOTFIX] -  nginx 설정에서 HTTP/2 프로토콜로 변경 및 프록시 헤더 추가 (#170)
@github-actions
Copy link

🛠️ Build Summary

Status: ✅ SUCCESS
Duration: 57초
Exit Code: 0
Commit: 2b7c1e2

📋 Build Output (마지막 45줄)

   Generating static pages (2/4) 
   Generating static pages (3/4) 
 ✓ Generating static pages (4/4)
   Finalizing page optimization ...
   Collecting build traces ...

Route (pages)                                 Size  First Load JS
┌ ƒ /                                      77.4 kB         639 kB
├   /_app                                      0 B         308 kB
├ ○ /404 (1432 ms)                         1.78 kB         312 kB
├ ○ /500 (1430 ms)                           757 B         309 kB
├ ƒ /api/auth/logout                           0 B         308 kB
├ ƒ /dashboard                             14.6 kB         634 kB
├ ƒ /interviews                            7.56 kB         346 kB
├ ƒ /interviews/[interviewId]              11.5 kB         604 kB
├ ƒ /interviews/[interviewId]/result       5.19 kB         363 kB
├ ○ /layout (1430 ms)                        541 B         309 kB
├   └ css/2af4d3721e97fa9b.css               280 B
├ ƒ /login                                  2.6 kB         313 kB
├ ƒ /login/callback                           2 kB         333 kB
├ ƒ /login/google/callback                    2 kB         334 kB
├ ƒ /login/profile                         11.3 kB         366 kB
├ ƒ /members/[memberId]                    3.63 kB         339 kB
├ ƒ /members/interviews/[interviewId]      6.84 kB         338 kB
├ ƒ /purchase                              6.39 kB         627 kB
├ ƒ /purchase/confirm                      1.76 kB         333 kB
├ ○ /purchase/error (1430 ms)                804 B         311 kB
├ ƒ /terms/privacy                         5.08 kB         337 kB
└ ƒ /terms/termsofuse                      4.48 kB         336 kB
+ First Load JS shared by all               323 kB
  ├ chunks/framework-962931b100bb889b.js   57.6 kB
  ├ chunks/main-61dca56d4090f90c.js         176 kB
  ├ chunks/pages/_app-0e244b3719a8da89.js  72.8 kB
  ├ css/d679a26ab67d1f1c.css               15.1 kB
  └ other shared chunks (total)            1.89 kB

ƒ Middleware                               96.7 kB

○  (Static)   prerendered as static content
ƒ  (Dynamic)  server-rendered on demand

   Memory usage report:
    - Total time spent in GC: 386.61ms
    - Peak heap usage: 68.50 MB
    - Peak RSS usage: 679.43 MB

🤖 Generated by GitHub Actions at Sat Sep 20 17:26:28 UTC 2025

@github-actions
Copy link

🚀 Lighthouse Report for TEST1

📅 Date: 9/20/2025

Category Score
🔴 Performance 21
🟢 Accessibility 96
🟢 Best Practices 96
🟢 SEO 100

📊 Performance Details

Metric Score Value
🟢 First Contentful Paint 100 1.0 s
🔴 Largest Contentful Paint 15 5.8 s
🔴 Cumulative Layout Shift 15 0.518

🚀 Lighthouse Report for TEST2

📅 Date: 9/20/2025

Category Score
🔴 Performance 25
🟢 Accessibility 96
🟢 Best Practices 96
🟢 SEO 100

📊 Performance Details

Metric Score Value
🟢 First Contentful Paint 100 0.9 s
🔴 Largest Contentful Paint 18 5.6 s
🔴 Cumulative Layout Shift 15 0.518

🚀 Lighthouse Report for TEST3

📅 Date: 9/20/2025

Category Score
🔴 Performance 26
🟢 Accessibility 96
🟢 Best Practices 96
🟢 SEO 100

📊 Performance Details

Metric Score Value
🟢 First Contentful Paint 100 0.9 s
🔴 Largest Contentful Paint 17 5.6 s
🔴 Cumulative Layout Shift 15 0.518

🚀 Lighthouse Report for TEST4

📅 Date: 9/20/2025

Category Score
🔴 Performance 27
🟢 Accessibility 96
🟢 Best Practices 96
🟢 SEO 100

📊 Performance Details

Metric Score Value
🟢 First Contentful Paint 100 0.9 s
🔴 Largest Contentful Paint 21 5.4 s
🔴 Cumulative Layout Shift 15 0.518

🚀 Lighthouse Report for TEST5

📅 Date: 9/20/2025

Category Score
🔴 Performance 26
🟢 Accessibility 96
🟢 Best Practices 96
🟢 SEO 100

📊 Performance Details

Metric Score Value
🟢 First Contentful Paint 100 0.9 s
🔴 Largest Contentful Paint 20 5.4 s
🔴 Cumulative Layout Shift 15 0.518

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.

1 participant