This message (and any attachments) contains confidential information and
is protected by law. If you are not the intended recipient, you should
delete this message and are hereby notified that any disclosure,
copying, distribution, or the taking of any action based on this
message, is strictly prohibited.
How could I configure nginx so that when a download is started and when
it completes, it makes a HTTP GET request to another web server?
This is not possible.
You need to write a custom Nginx module.
Writing the module is not hard, the complex thing is the HTTP GET, since
it should be done so that Nginx main process is not blocked during
request.
However there are alternatives, as an example you can have Nginx write
to a FIFO in asynchonous mode, and have an external process read the
FIFO and do the work.
If FIFO is busy (external process is slow to read data), however, Nginx
will have to skip sending notification.
[…]
Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
How could I configure nginx so that when a download is started and when
it completes, it makes a HTTP GET request to another web server?
This is not possible.
You need to write a custom Nginx module.
I think you should be able to use the ngx_http_echo_module to achieve
this. Just use an echo_subrequest directive to send a request to the
URL that you want. This request will only be made once the upload has
completed. Any other module that calls a subrequest after the files
have been uploaded should work too.
One thing : if you don’t know the server that you’ll connect to at the
time the config file is read, you’ll need to set up a resolver for DNS.
this. Just use an echo_subrequest directive to send a request to the
URL that you want. This request will only be made once the upload has
completed. Any other module that calls a subrequest after the files
have been uploaded should work too.
One thing : if you don’t know the server that you’ll connect to at the
time the config file is read, you’ll need to set up a resolver for DNS.
Another problem is that the external server should be able to process
the same number of requests per second of the Nginx server.
This is the reason why, as an example, Nginx does not support syslog.
Regards Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
Another problem is that the external server should be able to process
the same number of requests per second of the Nginx server.
This is the reason why, as an example, Nginx does not support syslog.
Presumably if an upload tracker is required, the number of requests
relative to the volume of data transfer will be low (at least for this
type of operation on that server), so even if the other server isn’t as
perfomant as Nginx, I don’t think this should be a problem.
Robert could of course install Nginx on the other server as well, or
perhaps even just make a call to a FastCGI/WSGI process directly from
Nginx.
Another problem is that the external server should be able to process
the same number of requests per second of the Nginx server.
This is the reason why, as an example, Nginx does not support syslog.
Not sure why it would need to because the other server would handle a
mere fraction of the requests. In particular, nginx would be handling
thousands of byte-range requests per file downloaded. The other server
would just get 2 requests per file downloaded and in the case of an
incomplete download, only 1 request.
–
Robert La Ferla
VP Engineering
OMS SafeHarbor
This message (and any attachments) contains confidential information and
is protected by law. If you are not the intended recipient, you should
delete this message and are hereby notified that any disclosure,
copying, distribution, or the taking of any action based on this
message, is strictly prohibited.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.