I have a Tomcat instance running on Jelastic and there are two deployed apps - for \'/foo\' context and for \'/bar\' context.
During handling request to \'/foo\' we
A "connection refused" message means that something was unable to open a network connection at the transport level. This most likely means that the service you are trying to talk to is not listening for new connections on the specific IP and port number that were used in the connection attempt.
Check:
Bear in mind that your system may have multiple IP addresses, and you need to listen on each one that you wish to use. Also bear in mind that "local host" is typically a different IP address.
Then if neither of the above is the problem:
It looks like that the Tomcat somehow filter incoming connections from the same host.
Tomcat doesn't "filter" like that. But it is quite possible that you haven't configured tomcat to listen for the requests. Check the "server.xml" file to see if you have configured that correctly.
FWIW - I don't think this is the Tomcat7 CSRF filter. According to the documentation, that would return a HTTP response. In fact, I can't see how anything inside the receiving Tomcat could generate a "connection refused" state by any means other than not listening for connections in the first place.