Hi all
I'm fairly new to nginx development (although I'm fairly experienced in
Apache-development and in event driven programming) and have some
questions about the recommended design for a complex module.
What do I want to archive?
1. read header and body from an incoming request
- seems to work
2. from this original request, create a POST sub request to another server.
- seems to work. I use a sub-request to '/foo' and added a location
'/foo' which do a proxy_pass to http://foo/.
Question: Can I do this without touching the nginx.conf? I would like to
specify the IP/port of the subrequest in my handler and _not_ add a
special location to nginx.conf
3. read the whole response from this sub request into memory
Question: What is the recommended way to read and process the response
body of a sub request which shouldn't go to the client? Should I use a
body-filter or can I access the response body from my post-subrequest
handler. I tried the later but it does not work. Any example code?
4. modify the original request (header and possibly body) depending on
the data from the sub request
5. send the new main request upstream
- I assume that I simply should modify the request and return a
DECLINED to let the next handler do the work.
6. intercept the response, do a second subrequest and modify the response
- should probably done in a filter?
Another question: I want to intercept ALL requests to nginx. Which phase
would you recommend for my handler? How can I assure, that I'm the first
handler in the chain?
Thanks for you help
Mirko
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://nginx.org/mailman/listinfo/nginx-devel