Setting headers and cookies when proxying

Hi,

I am trying to write a module that will insert a header into the request
that is sent to the upstream servers (mongrels). I can set headers based
on
the code found in some other modules, but all set the header on the
response
headers, not the headers proxied forward. I also would like to set a
cookie
in the same form - add a cookie to the headers that will be passed to
the
upstream servers.

Any ponters as to where to look for something like that? Or some other
information that could help?

This is to be used in a multi-server load-balancing situation that
require
client stickiness. My plan is to release this code so others could use
it
once it’s stable.

Bye,

Guy.

Hello!

On Fri, Aug 15, 2008 at 06:22:45PM -0700, Guy N. wrote:

information that could help?
Um. Just use proxy_set_header directive and allow user to
configure it by hand (e.g. using variable from your module)?

You probably may modify r->headers_in too, but I’m not sure it’s a
good idea.

Maxim D.

On Fri, Aug 15, 2008 at 06:22:45PM -0700, Guy N. wrote:

This is to be used in a multi-server load-balancing situation that require
client stickiness. My plan is to release this code so others could use it
once it’s stable.

As it was already suggested, you do not need a module for this, you may
use configuration:

    proxy_set_header  header   value;

Hi,

That will set a header, but will not allow me to set a cookie. If I use:

set_proxy_header Cookie whatever=something;

It overwrites the cookies sent by the browser. Is there a way to add a
cookie this way?

Bye,

Guy.

On Fri, Aug 15, 2008 at 10:35:40PM -0700, Guy N. wrote:

That will set a header, but will not allow me to set a cookie. If I use:

set_proxy_header Cookie whatever=something;

It overwrites the cookies sent by the browser. Is there a way to add a
cookie this way?

set_proxy_header Cookie “whatever=something;$http_cookie”;

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