Angular proxy.conf.json to call API works locally

2019-08-17 09:01发布

I have two things deployed to Heroku: an Angular web app and an API (made with Python/Flask).

When running my Angular web app locally, I can call my API that is hosted on Heroku and can get that data, but when my Angular app is hosted on Heroku it does not work.

proxy.conf.json

{
    "/api": {
        "target": "https://bbd-api.herokuapp.com",
        "secure": false,
        "changeOrigin": true
    }
}

log

2018-11-15T19:58:15.809915+00:00 heroku[router]: at=info method=GET path="/api/bar" host=bar-beer-drinker.herokuapp.com

It seems like the GET path is not fully there. It's not adding on the target. Not sure if it's supposed to be like that.

Is there something different I have to do for production on Heroku?

If there is some other files you'd like to see let me know.

0条回答
登录 后发表回答