Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Server Sent Events Config

$
0
0
I try to get django-sse working on my aws instance. For development my django runs on localhost:8000 and the EventSource points to something like this http://localhost:8000/stream1/?lastEventId=&r=5546342101865558. I receive the events immediately.

Following this post http://stackoverflow.com/questions/13672743/eventsource-server-sent-events-through-nginx I tried this config in production:

upstream message_upstream {
server 54.216.184.203:443;
}

server {
listen 80;
server_name ${cfg:domain_list} ${cfg:redirect_domain_list};
rewrite ^ https://${cfg:domain}$request_uri? permanent;
}

server {
listen 443 ssl;
server_name ${cfg:domain_list};
access_log /var/log/nginx/${cfg:domain_slug}.access.log;

root ${buildout:directory}/public_html;

ssl on;
ssl_certificate /etc/ssl/certs/.... ;
ssl_certificate_key /etc/ssl/certs/......;

location / {
include uwsgi_params;
uwsgi_pass unix:///tmp/${cfg:domain_slug}.sock;
}

location /media {

}

location /static {

}

location ~ ^/stream1 {
proxy_pass https://message_upstream;
proxy_buffering off;
proxy_cache off;
proxy_set_header Host $host;

proxy_set_header Connection '';
proxy_http_version 1.1;
chunked_transfer_encoding off;
}
}


With SSL my configuration differs from the one mentioned in the stackoverflow post. The monitors in my amazon console show a huge amount of traffic. And in the nginx log I get:

2013/08/16 06:00:18 [error] 25173#0: *6473 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 54.216.184.203, server: nachhilfe.impac.ch, request: "GET /stream1/?lastEventId=&r=4599838461726904 HTTP/1.1", upstream: "https://54.216.184.203:443/stream1/?lastEventId=&r=4599838461726904", host: "nachhilfe.impac.ch", referrer: "https://nachhilfe.impac.ch/user/1/"

The rest of the site is running correctly and as mentioned on my machine the sse part is working.

What am I missing?

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>