I am now developing a HTTP proxy based on nginx.
My HTTP proxy works as followed:
Authorizing Server ^ | +-(authorized)----> go straightly 1 2| 3V 4 |
client -> HTTP proxy (nginx)–+
±(un-authorized)-> go to another web
The steps are:
- client sends a request to nginx
- nginx sends the client’s request to a authorizing server by socket
- nginx waits to receive 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 for redirecting.
- nginx delivers the original client’s request to the web 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
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?