<div dir="ltr"><div><div><div><div>Hello,<br></div>Following is a problem I am facing while using nginx as a proxy, please provide me feedback and ideas to solve it.<br></div>I have a zookeeper based service discovery setup. For some of the services I want to use nginx as a proxy. <br><br>Flow I am planning to set is like this..<br></div>Client connects to nginx with some user id, based on userid nginx handler need to do a "lookup in ZK" and find out a service instance. Then pass request to service using "proxy_pass" .<br><br><br></div><div>Problem I am facing is how to do this "lookup" along with proxy_pass. I understand that I may need to register my handler in one of the phase explained here <a href="http://wiki.nginx.org/Phases">http://wiki.nginx.org/Phases</a> .<br></div><div>Most likely it will "rewrite", but that allows on regex. How I can invoke a functionality bundled in jar?<br><br></div><div>Please note I am also aware of <a href="http://nginx-clojure.github.io/">http://nginx-clojure.github.io/</a> which allows you to execute java handlers through nginx, but not really sure how to use it with "proxy_pass".<br><br></div><div>Thanks in advance for your help.<br></div><div>Best Regards,<br></div><div>Vikrant<br></div></div>