준준의 기록일지

[Heroku] CORS Policy?? No, It was about Application.yml doesn't upload or set heroku config in Heroku 본문

CLOUD

[Heroku] CORS Policy?? No, It was about Application.yml doesn't upload or set heroku config in Heroku

junjunwon 2022. 5. 3. 20:52

"이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다."




Hi, Today we are going to talk about how to upload or set configuration of application.yml to Heroku.

my application as backend(springboot) and frontend (vue.js)  was working properly in local. 

But, I got into a trouble that when I deploy on Heroku my backend application. 

It kept occurring CORS Policy Problem on Network of Chrome DevTool. 

So, I tried to figure out Spring security to solve Cors policy probs. However It didn't work. 

So, I check heroku logs --tail

 

code : heroku logs --tail (Terminal)

Then, I realized It wasn't about Cors policy. Maybe it was occured because heroku didn't know about my all of information in application.yml because I put this file in gitignore!!

 

So, I looked into this.

they said I need to set heroku config. So, I set all of my application.yml information in heroku dashboard

 

You can check these out below

 

I put same path on heroku config vars just like application.yml.

 

and IT WORKS!

 

I put some keys like "AWS_ACCESSKEY" it is for the situation when you want to get rid of application.yml from gitignore and push this to github and heroku. you can put

cloud.aws.credentials.accesskey : ${AWS_ACCESSKEY}

So your information in application.yml will be secured!!! even if you upload your application.yml.

 

 

references : 

https://devcenter.heroku.com/articles/preparing-a-spring-boot-app-for-production-on-heroku

 

Preparing a Spring Boot App for Production on Heroku | Heroku Dev Center

Last updated November 29, 2021 It is important to ensure that an app is secure, scalable, and resilient to failure before sending it to production. This guide provides an overview of many common and important steps required to make a Spring Boot app produc

devcenter.heroku.com