Dynamic proxy_pass?


#1

Hello,

[nginx 0.6.32]

I would like to setup a dynamic proxy_pass. More specifically, given
an HTTP request’s authorization header, I would like to proxy the
request to a specific upstream server.

For example, given a cdb [1] of ‘user’ -> ‘server’, upon receiving a
request, dispatch a given user to a given server.

What would be a reasonable way to achieve such effect with nginx?

Thanks in advance for any pointers.

Kind regards,


PA.
http://alt.textdrive.com/nanoki/

[1] http://cr.yp.to/cdb.html


#2

It seems I have the same problem like you

I am developing http proxy on nginx.
All of the clients’ requests go through nginx.
my step is:

  1. client sends a request to nginx
  2. nginx sends the client’s request to a authorizing server by socket
    (another computer)
  3. nginx receives the response from authorizing server
    the authorizing server will tell nginx whether the client have right
    to visit the web
    if the client have no right, the authorizing server will give another
    website.
  4. nginx delivers the original client’s request to the server
    according to the authorizing server’s response.

This means nginx has to do two socket communication.
The first is with authorizing server.
The second is with real web server.

The key is it should not be blocked by any steps.
So these two socket communication should be done by module.
I can’t create socket and read/write it myself. It will pull down the
nginx’s performance.

But how to create a two socket communication module
or
how to mount two modules(one for authorizing, one for real server) to
the same location to deal with one request
.

This is what bothers me long time.

Does anybody have good idea?

Petite A. wrote:

Hello,

[nginx 0.6.32]

I would like to setup a dynamic proxy_pass. More specifically, given
an HTTP request’s authorization header, I would like to proxy the
request to a specific upstream server.

For example, given a cdb [1] of ‘user’ -> ‘server’, upon receiving a
request, dispatch a given user to a given server.

What would be a reasonable way to achieve such effect with nginx?

Thanks in advance for any pointers.

Kind regards,


PA.
http://alt.textdrive.com/nanoki/

[1] http://cr.yp.to/cdb.html