Nginx-ru mailing list archive (nginx-ru@sysoev.ru)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Возможно ли использовать nginx как туннель с кешированием статики и websockets
- To: nginx-ru@xxxxxxxxx
- Subject: Возможно ли использовать nginx как туннель с кешированием статики и websockets
- From: "tao" <nginx-forum@xxxxxxxx>
- Date: Wed, 03 Jul 2013 05:45:24 -0400
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=helium.jlkhosting.com; s=x; h=Date:Sender:From:Message-ID:Content-Transfer-Encoding:Content-Type:Subject:To; bh=nYn+2Kl8gqXQrDyAHc0Yuf9t9XZnwCd11W5UbLJPwDc=; b=Y8FrwJxBZ+oicgOVYoYEr0HcDJUnUDi45kSf/g4fozHtVJby51aeKmZByCg4Ui8oocCoS7mSctNLtPNlG3gdVOsVSor4RIh54ooaOpE/OuDvabyukHxOzXUhSAATRXdr3U/acnDtucaYEWtX2FhZFvCArddlJEQ1saYxfGER6iQ=;
в браузере-клиенте (chrome) прописан ip http proxy (nginx)
на домене club по 3000 порту висит socket.io с поддержкой xhr-pooling и
websockets и nginx для отдачи статики по 80 порту
все хорошо и отлично кешируется c 80 порта, xhr-pooling тоже работает
отлично
Но как только переключаюсь на websockets , получаю в логи
==
[ 03/Jul/2013:11:50:17 +0400 ] - "CONNECT club:3000 HTTP/1.1" "400"
"rt:0.018" "urt:-" "cache: -"
==== CONFIG
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream club_80 { server club:80;}
upstream club_3000 { server club:3000;}
server {
listen 8090;
server_name _;
access_log /var/log/nginx/proxy.8090.access.log common;
error_log /var/log/nginx/proxy.8090.error.log;
source_charset utf-8;
charset utf-8;
recursive_error_pages on;
#upstream mapping
set $xport 80;
if ($http_host ~ ":(\d+)") { set $xport $1; }
set $upstr "club_${xport}";
error_page 417 = @cached;
error_page 418 = @nocached;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_buffering off;
location / {
return 417;
}
location /socket.io {
return 418;
}
location ~ /(ru|en/)?index.html {
return 418;
}
#for index/socket.io
location @nocached {
proxy_read_timeout 86400;
proxy_cache off;
proxy_pass http://$upstr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header Cache-Control
"no-cache,no-store,must-revalidate";
expires -1;
}
#for static
location @cached {
proxy_cache_methods GET;
proxy_cache_valid 200 5d;
proxy_cache clubcache;
proxy_pass http://$upstr;
proxy_set_header Host $host:$proxy_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache_bypass $cookie_nocache $arg_nocache$arg_comment;
proxy_cache_bypass $http_pragma $http_authorization;
proxy_ignore_headers X-Accel-Expires Expires Cache-Control
Set-Cookie;
add_header Cache-Control "no-cache,no-store,must-revalidate";
expires -1;
}
}
================= END
Posted at Nginx Forum:
http://forum.nginx.org/read.php?21,240532,240532#msg-240532
_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://mailman.nginx.org/mailman/listinfo/nginx-ru
|