bwagner
bwagner

Reputation: 1029

Nginx upstreams and Heroku

I would like to use Nginx upstreams to balance two instances of an application, one of them is on an EC2 server and the other on Heroku.

The problem is, when I put the app.herokuapp.com in the upstream directive, it resolves to the ip address, and the requests are sent to the ip address, but heroku uses the host to identify the application, so it doesn't work.

I'm stuck on this, what could I do?


Update: My app uses host too, so I think I am stuck on this. As I can't change Heroku, I guess I will have to add a header with the original request Host to be used by my application and keep the Host as default, so Heroku will find my application

Upvotes: 2

Views: 742

Answers (1)

Alexey Ten
Alexey Ten

Reputation: 14354

Add Host header to proxy.

proxy_pass http://upstream;
proxy_set_header Host $host;
....

Upvotes: 3

Related Questions