Combining Rails and nginx_push_module

saile nginx-forum at nginx.us
Wed Dec 2 11:34:20 MSK 2009


Hi,

I am trying to combine a Rails & Thin configuration with the nginx push module. I have these two config snippets:

Rails & Thin:


upstream thin {
    server 127.0.0.1:8000;
    server 127.0.0.1:8001;
    server 127.0.0.1:8002;
}

server {
	listen   80;
	server_name  localhost;
	access_log  /var/log/nginx/localhost.access.log;
	root /var/www/test/public;
	
	location / {
		proxy_set_header  X-Real-IP  $remote_addr;
		proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header Host $http_host;
		proxy_redirect false;
		if (-f $request_filename/index.html) {
		        rewrite (.*) $1/index.html break;
		}
		if (-f $request_filename.html) {
		        rewrite (.*) $1.html break;
		}
		 if (!-f $request_filename) {
		        proxy_pass http://thin;
		        break;
		}
	}
}



Nginx Push Module


	# internal publish endpoint (keep it private / protected)
	location /publish {
		set $push_channel_id $arg_id;      #/?id=239aff3 or somesuch
		push_publisher;
    	
		push_store_messages on;            # enable message queueing 
		push_message_timeout 2h;           # expire buffered messages after 2 hours
		push_max_message_buffer_length 10; # store 10 messages
		push_min_message_recipients 0;     # minimum recipients before purge
		break;
	}

	# public long-polling endpoint
	location /activity {
		push_subscriber;
    	
		# how multiple listener requests to the same channel id are handled
		# - last: only the most recent listener request is kept, 409 for others.
		# - first: only the oldest listener request is kept, 409 for others.
		# - broadcast: any number of listener requests may be long-polling.
		push_subscriber_concurrency broadcast;
		set $push_channel_id $arg_id;
		default_type  text/plain;
		break;
	}



But when I insert the push module code the requests for "publish" and "activity" still are handeled by Rails.

How would you solve that?


Regards,

Elias

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,27303,27303#msg-27303





More information about the nginx mailing list