# Ngx\_http\_secure\_download report back to application?

**URL:** <https://www.ruby-forum.com/t/ngx-http-secure-download-report-back-to-application/207096>\
**Category:** NGINX\
**Created:** [May 18, 2011, 9:50am UTC](https://www.ruby-forum.com/t/ngx-http-secure-download-report-back-to-application/207096 "2011-05-18T09:50:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [May 18, 2011, 9:50am UTC](https://www.ruby-forum.com/t/ngx-http-secure-download-report-back-to-application/207096/1 "2011-05-18T09:50:18Z")

</div>

Hello,

I’m thinking about writing an application, which should use nginx’  
secure download module to generate secure - expireing - links and limit  
the number of (successful) downloads. Since it only should count  
successful downloads it needs to know if the download was successful so  
it would be good to have nginx report to the application “Hey, I’ve got  
one more complete download”. In the best case also “Download failed, but  
I transfered N bytes” for statistical reasons inside the application  
(This could be used to track traffic usage by file and stop generating  
links if a traffic limit has passed).

The download server and the application server could - but haven’t to -  
run on different machines.

Now my question is: Is something like this possible? Can I send a  
response to an application in - let’s say XML or JSON? And if yes: How?

Thanks in advance,

Pascal Nitsche

---

<div class="post-metadata">

**Author:** ![Pascal\_Nitsche](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/77aa72/32.png) [@Pascal\_Nitsche](https://www.ruby-forum.com/u/Pascal_Nitsche)\
**Post date:** [May 18, 2011, 3:04pm UTC](https://www.ruby-forum.com/t/ngx-http-secure-download-report-back-to-application/207096/2 "2011-05-18T15:04:24Z")

</div>

Hi,

You can do this with [http://wiki.nginx.org/HttpCoreModule#post\_action](http://wiki.nginx.org/HttpCoreModule#post_action)  
and [http://wiki.nginx.org/HttpCoreModule#.24request\_completion](http://wiki.nginx.org/HttpCoreModule#.24request_completion)

Sincerely,  
Martin Fjordvald

Posted at Nginx Forum:

> **[Re: ngx\_http\_secure\_download report back to application?](https://forum.nginx.org/read.php?2,198967,199037#msg-199037)**
>
> Hello, I'm thinking about writing an application, which should use nginx' secure download module to generate secure - expireing - links and limit the number of (successful) downloads. Since it only should count successful downloads it needs to know...

---

<div class="post-metadata">

**Author:** ![Pascal\_Nitsche](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/77aa72/32.png) [@Pascal\_Nitsche](https://www.ruby-forum.com/u/Pascal_Nitsche)\
**Post date:** [May 18, 2011, 4:35pm UTC](https://www.ruby-forum.com/t/ngx-http-secure-download-report-back-to-application/207096/3 "2011-05-18T16:35:54Z")

</div>

Hello Ensiferous,

thanks for your answer I think this will do the trick. Is there also a  
possibility to get the transfered bytes inside the request? (This would  
be really nice but is just optional.)

Thanks for your help again,

Pascal Nitsche

Am 18.05.2011 15:03, schrieb Ensiferous:
