# Generating a new request when handling one in a module

**URL:** <https://www.ruby-forum.com/t/generating-a-new-request-when-handling-one-in-a-module/245816>\
**Category:** NGINX\
**Created:** [July 18, 2013, 5:25am UTC](https://www.ruby-forum.com/t/generating-a-new-request-when-handling-one-in-a-module/245816 "2013-07-18T05:25:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [July 18, 2013, 5:25am UTC](https://www.ruby-forum.com/t/generating-a-new-request-when-handling-one-in-a-module/245816/1 "2013-07-18T05:25:25Z")

</div>

I want to modify third party longpoll module nginx\_http\_push\_module (  
[http://pushmodule.slact.net/](http://pushmodule.slact.net/) ) to notify upstream every time a request  
hangs  
waiting for a new publication, sending original headers and all, so I  
know  
in my upstream application that there is a user connected on the  
channel,  
and even what user is it, if I can have access to the session cookies.  
The  
results of this notification request isn’t really going anywhere and is  
not  
of interest.

My idea was to generate a new request to a “internal” marked location,  
copying the relevant headers from the original request, while handling  
the  
later (thus inserting a new request in the nginx HTTP request processing  
stack, and discarding its results). This new request would be  
independent  
from there on.

At first it seemed a simple approach, but now that I browsed through  
some  
examples modules, I am not so sure anymore. I failed to find any module  
that  
does something like this, and I could not find the relevant API to  
“offspring” such relatively independent HTTP request.

Do you think this is a good approach? Can you point me the API I should  
use,  
or a sample module that does something like this?

Posted at Nginx Forum:

> **[Generating a new request when handling one in a module](https://forum.nginx.org/read.php?2,240974,240974#msg-240974)**
>
> I want to modify third party longpoll module nginx\_http\_push\_module ( http://pushmodule.slact.net/ ) to notify upstream every time a request hangs waiting for a new publication, sending original headers and all, so I know in my upstream application...
