How to retrieve HTTP header from Apache in nginx?

Hi,

I have the following setup:

Apache -> Squid -> nginx -> Zope

Zope needs a header that is set by Apache in httpd.conf like the
following:

RequestHeader set USER %{VALUE}

My question is, how can I ask nginx to pass on this header to Zope?
I’m sure nginx is the problem because if I take nginx out of the chain:

Apache -> Squid -> Zope

Zope can immediately see the header.

I tried using the proxy_set_header directive like the following in
nginx.conf

proxy_set_header USER $USER

but it doesn’t seem to work.

Any help is apprecaited. Thanks a lot!

Regards,

Alex

On Tue, Sep 09, 2008 at 01:53:04PM -0700, Alex Man wrote:

Apache -> Squid -> Zope

Zope can immediately see the header.

I tried using the proxy_set_header directive like the following in
nginx.conf

proxy_set_header USER $USER

but it doesn’t seem to work.

You should do nothing on nginx side: it will pass the header to Zope by
default.

BTW, I think that nginx is unneccessary in this chain:

Apache -> Squid -> nginx -> Zope

and probably

Squid -> Apache -> Zope

is more logical chain.

Hi Igor,

Thanks for your response.

Actually, I’m using nginx as a load balancer for a number of ZEO
clients and a ZEO server. So the more precise picture should be

Aapche -> Squid -> nginx -> ZEO clients -> ZEO server (Plone)

The reason that I’m using nginx as a load balancer is that is has
http://wiki.codemongers.com/NginxHttpUpstreamFairModuleFair Proxy
Balancer that Apache and Squid don’t have.

Since I’ve tried taking nginx out of the chain and I see that Plone
recognize the header, there must be something about nginx that’s
causing it. Do you have any idea on that? My nginx.conf is something
like this

worker_processes 1;

events {
worker_connections 256;
}

http {
upstream zeo_clients {
server <ip_of_zeo_client1>;
server <ip_of_zeo_client2>;

fair;
}

 server {
     listen 3800;
     server_name  localhost;

     location / {
         proxy_pass http://zeo_clients;
     }
 }

}

Thanks a lot!

At 10:13 PM 9/9/2008, Igor S. wrote:

My question is, how can I ask nginx to pass on this header to Zope?

Squid -> Apache -> Zope

is more logical chain.


Igor S.
http://sysoev.ru/en/

Regards,

Alex

Hi Aleks,

Thanks for your response.

The reason I’m using nginx instead of other load balancers such as
HAProxy and Pound is that they don’t support (I believe) the fair
balancing algorithm provided by the Fair Proxy Balancer
(http://wiki.codemongers.com/NginxHttpUpstreamFairModule) module of
nginx. I would like the load balancer to send request to the
least-busy ZEO client.

I’m using Apache because I’m also using
http://shibboleth.internet2.edu/Shibboleth for authentication and I
believe the Shibboleth module can only be loaded in Apache.

So, should I still be using nginx for the reason I listed above? Thanks
a lot!

At 01:57 PM 9/10/2008, Aleksandar L. wrote:

Aapche -> Squid -> nginx -> ZEO clients -> ZEO server (Plone)
Squid -> Apache -> Zope

Why do you use such a complex setup?!

Apache -> Squid -> nginx -> Zope

BR

Aleks

Regards,

Alex

Hi Alex,

On Fre 12.09.2008 11:16, Alex Man wrote:

Hi Aleks,

Thanks for your response.

The reason I’m using nginx instead of other load balancers such as
HAProxy and Pound is that they don’t support (I believe) the fair
balancing algorithm provided by the Fair Proxy Balancer
(http://wiki.codemongers.com/NginxHttpUpstreamFairModule) module of
nginx. I would like the load balancer to send request to the
least-busy ZEO client.

ok.

haproxy can at the moment only:

roundrobin, leastconn, source IP address, uri, url_param and appsession
balancing

the least-busy is pland but a eta is not available.

I’m using Apache because I’m also using
http://shibboleth.internet2.edu/Shibboleth for authentication and I
believe the Shibboleth module can only be loaded in Apache.

So, should I still be using nginx for the reason I listed above?
Thanks a lot!

I think yes.

BR

Aleks

Hi Aleks,

Thanks for your information.

My problem is that, as I described in my first email, a header is not
passed by nginx to the ZEO clients for some reason. Igor said that it
should pass the header to Zope by default but I think it’s not doing
that since as soon as I take nginx out of the chain, Plone can see the
header.

For your reference, the following is my first email with some more
details:

I have the following setup

Apache -> Squid -> nginx -> ZEO clients -> ZEO server (Plone)

Plone needs a header for authentication that is set by Apache in
httpd.conf like the following:

RequestHeader set USER %{VALUE}

My question is, how can I ask nginx to pass on this header to Zope?
I’m sure nginx is the problem because if I take nginx out of the chain:

Apache -> Squid -> ZEO clients -> ZEO server (Plone)

Plone can immediately recognize the user (so I assume it sees the
header).

I tried using the proxy_set_header directive like the following in
nginx.conf

proxy_set_header USER $USER

but it doesn’t seem to work.

Any help is appreciated. Thanks a lot!

At 11:11 AM 9/13/2008, Aleksandar L. wrote:

(http://wiki.codemongers.com/NginxHttpUpstreamFairModule) module of
the least-busy is pland but a eta is not available.
BR

Aleks

Regards,

Alex

On Die 16.09.2008 11:49, Alex Man wrote:

Hi Aleks,

Thanks for your information.

My problem is that, as I described in my first email, a header is not
passed by nginx to the ZEO clients for some reason. Igor said that it
should pass the header to Zope by default but I think it’s not doing
that since as soon as I take nginx out of the chain, Plone can see the
header.

[snipp]

please can you send us a debug log?
http://wiki.codemongers.com/NginxDebugging

BR

Aleks

Hi Aleks,

My nginx wasn’t compiled with the debug module. Since I’ve another
urgent project coming in I guess I’ll just stick to the round-robin
algorithm that Apache/Squid provides and revisit nginx later on.
Thanks so much for your help!

At 12:55 AM 9/18/2008, Aleksandar L. wrote:

[snipp]

please can you send us a debug log?
http://wiki.codemongers.com/NginxDebugging

BR

Aleks

Regards,

Alex

Hi Alex,

On Mit 10.09.2008 11:24, Alex Man wrote:

Hi Igor,

Thanks for your response.

Actually, I’m using nginx as a load balancer for a number of ZEO
clients and a ZEO server. So the more precise picture should be

Aapche -> Squid -> nginx -> ZEO clients -> ZEO server (Plone)

yust a idea but why not use a ‘loadbalancer’ instead of a webserver?

e.g. haproxy, pound, …

or use the http://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html
so that you reduce the complexity of your setup?

I fully agree with Igor about the chain :wink:

Squid -> Apache -> Zope

or if you don’t want to deliver static content

Squid -> Zope

or

Squid -> $LB -> Zope

or the global question is:

Why do you use such a complex setup?!

Apache -> Squid -> nginx -> Zope

BR

Aleks

I was facing the same issue where I had a java client send a request
with custom headers set to JAVA_UPLOAD_FILENAME and similar which should
be forwarded to a backend server via proxy_pass. Non of the custom
headers arrived at the backend.
However when changing the headers to Java-Upload-Filename etc they
arrived just fine at the backend server.

Hope this helps someone…

Best, Daniel

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs