Reverse proxy


#1

Hi,

I’m trying to put the api server behind nginx and reverse proxy to it. I ran
into exactly the same problem explained here:
http://tickets.opscode.com/browse/CHEF-2589.

Is there anyone else with the same problem? Or with a fix for this?

It seems as if I need a separate login for tickets.opscode.com – is this the
case?

Cheers Otto

PS. Thanks for all the effort on chef; it’s awesome!


#2

On Monday, November 21, 2011 at 7:29 AM, otto@finworks.biz wrote:

Hi,

I’m trying to put the api server behind nginx and reverse proxy to it. I ran
into exactly the same problem explained here:
http://tickets.opscode.com/browse/CHEF-2589.

Is there anyone else with the same problem? Or with a fix for this?
Chef infers its hostname from HTTP Headers, so you just need to make sure nginx is setting them. We use:

proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

There’s a different header to set the hostname that’s a bit more pedantically correct, something like X-Forwarded-Host, but the above works for us.

It seems as if I need a separate login for tickets.opscode.com (http://tickets.opscode.com) – is this the
case?

It will be the same as wiki.opscode.com, but different than community.opscode.com

Cheers Otto

PS. Thanks for all the effort on chef; it’s awesome!

HTH,


Dan DeLeo


#3

proxy_set_header X-Forwarded-Proto https;

Thanks! We missed this one.

proxy_set_header X-Forwarded-Proto $scheme;

is perhaps a bit more generic. (Works here.)

Thanks a lot, things are moving along now…

There’s a different header to set the hostname that’s a bit more pedantically correct, something like X-Forwarded-Host, but the above works for us.

We have this one in addition:
proxy_set_header X-Forwarded-Server $host;

Perhaps this should be something else.

Cheers
Otto