Skip to content

Conversation

@iamjooon2
Copy link
Member

@iamjooon2 iamjooon2 commented Feb 14, 2025

gin-contrib/cors 통해 CORS 설정 추가해뒀어용

// main.go
corsConfig := cors.Config{
		AllowOrigins:  []string{"http://localhost:3000", "https://localhost:3000", "https://techbloghub.net"},
		AllowMethods:  []string{"GET", "POST", "OPTIONS", "DELETE", "PUT", "PATCH"},
		AllowHeaders:  []string{"Origin", "Content-Type", "Authorization"},
		ExposeHeaders: []string{"Content-Length"},
	}

gin.Default().Use(cors.New(corsConfig))

@iamjooon2 iamjooon2 requested a review from pilyang February 14, 2025 14:09
@github-actions
Copy link

report: Run #58

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Pending ⏳ Other ❓ Flaky 🍂 Duration ⏱️
2 2 0 0 0 0 0 104ms

🎉 All tests passed!

Github Test Reporter

Copy link
Member

@pilyang pilyang left a comment

Choose a reason for hiding this comment

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

Good~~
저는 내일 데이터추가랑 작업이랑 해보겠습니다ㅠㅜ

Comment on lines 47 to 51
corsConfig := cors.Config{
AllowOrigins: []string{"*"},
AllowMethods: []string{"GET", "POST", "OPTIONS", "DELETE", "PUT", "PATCH"},
AllowHeaders: []string{"Origin", "Content-Type", "Authorization"},
ExposeHeaders: []string{"Content-Length"},
Copy link
Member

@pilyang pilyang Feb 14, 2025

Choose a reason for hiding this comment

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

좋아용~

혹시 저희 서버랑 localhost만 허용하는 방법도 있나용?
저희 프론트 주소랑 로컬호스트에서만 허용해도 될것같아서용

Copy link
Member Author

Choose a reason for hiding this comment

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

좋아용~ 수정해둘게요!

@github-actions
Copy link

report: Run #59

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Pending ⏳ Other ❓ Flaky 🍂 Duration ⏱️
2 2 0 0 0 0 0 63ms

🎉 All tests passed!

Github Test Reporter

@iamjooon2 iamjooon2 merged commit 18ea001 into main Feb 15, 2025
2 checks passed
@iamjooon2 iamjooon2 deleted the chore/cors branch February 15, 2025 00:32
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.

3 participants