Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 35 lines (29 sloc) 1.144 kB
6404eb2 @slact info
authored
1 Nginx push module - redirect a request body to other waiting requests
2
3 If you want a long-polling server but don't want to wait on idle connections
4 via upstream proxies, use this module to have nginx accept client connections.
5 Communication with clients is done via a different location, one only accessible
6 to your application.
7
8 Example conf:
9
10 #message source server
11 server {
12 listen localhost:8089;
13 location / {
14 default_type text/plain;
15 set $push_id $arg_id; #/?id=239aff3 or somesuch
16 push_source;
17 }
18 }
19
20 #long-polling client server
21 server {
22 listen 8088;
23 location / {
24 default_type text/plain;
25 set $push_id $arg_id; #/?id=239aff3 or somesuch
26 push_destination;
27 }
28 }
29
30 Clients will connect to http://example.com:8088/?id=... and have the
31 response delayed until a message is POSTed to http://localhost:8089/?id=...
32 Messages can be sent to clients that have not yet connected, i.e. they are queued.
33
34 It's a damn good idea to make sure the push_source location is not visible
35 publically, as it is intended for use only by your application.
Something went wrong with that request. Please try again.