I am using node to communicate with the rails application.
How do I do this by creating the front end of nginx, which proxies my Rails application and my node application.
This circumvents the same origin policy and cross-communicates.
Here is a snippet of my nginx.conf
location /chat_service { rewrite /chat_service/(.+) /$1 break; proxy_pass http://localhost:9000/; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; }
This means that I can display html pages from my rails application and communicate with the node application without using nasty hacks like JSONP.
A complete example is getting out of the scope of this answer, but with a good proxy server you can get them to work together.
source share