Skip to content

Conversation

@ohprettyhak
Copy link
Contributor

@ohprettyhak ohprettyhak commented Mar 12, 2024

🌍 이슈 번호

✅ 작업 내용

  • 관객 및 매니저 앱에 NextJS의 rewrites 기능을 이용하여 프록시를 적용했습니다.
    • /api/:path* 경로에 요청을 보내면 서버 통신이 이루어집니다.

📝 참고 자료

  • process.env를 사용하는 경우 매니저 앱에서 프록시 연결이 정상적으로 되지 않아(POST 요청이 아니라 GET 요청만 보내는 경우 존재) next.config.js 파일 내에 명시적으로 작성했습니다.
  • 이에 따라 .env 파일이 사라져도 될 거 같습니다.

♾️ 기타

  • 현재 관객 앱에서 ECONNREFUSED 로 인한 오류가 발생하고 있는데, 찾아보니 정상적이지 않은 URL로 연결을 할 때 발생한다고 하더라구요.
  • 정상적이지 않은 URL로 연결 요청을 하는 경우 자동으로 'localhost:80' 으로 요청을 보내는데, 현재 관객 앱은 3000 포트에서 돌아가기 때문에, 80에 요청을 보내면 오류가 납니다.
  • 서버에 올리면 포트가 같아지니 문제는 없지만, 어디서 오류가 발생하는 것인지 정확하게 찾으면 좋을 거 같습니다. 간단하게 API 사용하는 부분 훑어봤는데 아직 못 찾았습니다.

@ohprettyhak ohprettyhak added the build Build changes label Mar 12, 2024
@ohprettyhak ohprettyhak self-assigned this Mar 12, 2024
@ohprettyhak ohprettyhak linked an issue Mar 12, 2024 that may be closed by this pull request
2 tasks
@netlify
Copy link

netlify bot commented Mar 12, 2024

Deploy Preview for hufscheer ready!

Name Link
🔨 Latest commit f3a02fc
🔍 Latest deploy log https://app.netlify.com/sites/hufscheer/deploys/65f0990409f77e00080feaef
😎 Deploy Preview https://deploy-preview-78--hufscheer.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 96
Accessibility: 100
Best Practices: 92
SEO: 91
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Mar 12, 2024

Deploy Preview for hufscheer-manager ready!

Name Link
🔨 Latest commit f3a02fc
🔍 Latest deploy log https://app.netlify.com/sites/hufscheer-manager/deploys/65f0990484aed00008840f01
😎 Deploy Preview https://deploy-preview-78--hufscheer-manager.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@seongminn seongminn left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!

return [
{
source: '/api/:path*/',
destination: 'https://backoffice.hufstreaming.site/:path*/',
Copy link
Member

Choose a reason for hiding this comment

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

destination은 여전히 환경 변수로 관리하면 보안에 더 유리하지 않을까요?

Copy link
Contributor Author

@ohprettyhak ohprettyhak Mar 12, 2024

Choose a reason for hiding this comment

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

네 저도 그렇게 생각합니다만, env 변수를 사용하는 경우 매니저 앱에서 GET 요청만 보내지는 오류가 발생하여 위와 같이 작성했습니다!

return [
{
source: '/api/:path*',
destination: 'https://api.hufstreaming.site/:path*',
Copy link
Member

Choose a reason for hiding this comment

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

여기도 마찬가지입니다!

@ohprettyhak ohprettyhak merged commit 59298a2 into main Mar 12, 2024
@ohprettyhak ohprettyhak deleted the build/proxy branch March 12, 2024 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Build changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUILD] 관객 및 매니저 앱 프록시 연결

3 participants