Welcome! Log In Create A New Profile

Advanced

architecture of a module - processing a response from a subrequest

Mirko Dziadzka
July 29, 2010 04:12AM
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
Subject Author Views Posted

architecture of a module - processing a response from a subrequest

Mirko Dziadzka 4319 July 29, 2010 04:12AM

Re: architecture of a module - processing a response from a subrequest

Piotr Sikora 1238 July 29, 2010 05:46AM

Re: architecture of a module - processing a response from a subrequest

Mirko Dziadzka 1165 July 29, 2010 07:06AM

Re: architecture of a module - processing a response from a subrequest

agentzh 1941 August 04, 2010 10:28PM

Re: architecture of a module - processing a response from a subrequest

Mirko Dziadzka 1298 July 29, 2010 10:04AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 234
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready