tonycoco / heroku-buildpack-ember-cli

A Heroku Buildpack for Ember CLI Applications
MIT License
321 stars 121 forks source link

API proxy not working #116

Closed robinboening closed 8 years ago

robinboening commented 8 years ago

Hey there,

first things first: thanks for providing this buildback! :)

I have a rails service deployed on heroku which serves an api for my separate ember app, also running on heroku.

Locally I start the ember app using --proxy localhost:3000 to connect to the api. I noticed setting the API_URL on heroku should do almost the same, right? https://github.com/tonycoco/heroku-buildpack-ember-cli#api-proxy I tried that but got weird parsing errors after deployment.

I fixed it by adding the host to the RESTAdapter in application.js, but this is just a workaround.

Thanks Robin

tonycoco commented 8 years ago

You should basically have the API requests passthrough to your actual backend like so...

Client makes a request to /api/some_resources/1.json and then the buildpack takes care of routing the local request to something like http://API_URL/some_resources/1.json

acwright commented 8 years ago

I am also experiencing this problem. I set the API_URL config variable and my deployed app does not use this when making backend requests. It appears requests are not being properly routed. Any update on this issue?

davidjrice commented 8 years ago

I'm also seeing this. nginx is returning a 405 http code.

2016-01-21T14:02:43.377162+00:00 heroku[router]: at=info method=POST path="/login" host=xxxx.herokuapp.com request_id=44d93d77-fced-46e9-831e-9e1dc70cf537 fwd="XX.XX.XXX.XXX" dyno=web.1 connect=0ms service=1ms status=405 bytes=713

API_URL is set in configuration

=== xxxx Config Vars
API_URL:   https://xxxx-api.herokuapp.com/
EMBER_ENV: production

and deployment, buildpack is detected (no errors/warnings in deployment logs)

git push heroku master                                                                                                                                   
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 289 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Fetching set buildpack https://github.com/tonycoco/heroku-buildpack-ember-cli.git... done
remote: -----> Ember CLI app detected
remote: -----> Exporting config vars to environment
remote: -----> Building environment: production
...

and finally, I've tried the recommendations on REBUILD_ALL and purging the repo cache. No joy.