0

I'm writing an angular/clojure ring webapp. All routes to the ring side will have an "/api" prefix and will be routed with compojure.

Serving upp all other static file with ring seems a bit messy though.

Is there a good way to direct "/api/whatever" requests to ring and all other to be served up as static files using jetty? or using any other major web server, like apache, nginx, lighttpd?

4ZM
  • 1,463
  • 1
  • 11
  • 21

2 Answers2

2

We put nginx infront of jetty and have nginx configured to serve the static stuff (actually redirects to a CDN) directly and proxy all the app stuff to jetty. In production jetty is running on a separate load balancer though this works out the same if they are running on the same instance.

Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214
Arthur Ulfeldt
  • 90,827
  • 27
  • 201
  • 284
  • Ok, that sounds good. Are you using a more lightweight solution for testing? Local nginx with proxy of different ports? – 4ZM Nov 12 '13 at 01:34
  • When people are working on both frontend and api stuff they can run nginx on a vitualbox instance on their laptop with the front end code mapped into it with a shared folder and the api code either run through emacs+lein or on it's own AWS instance produced through pallet. – Arthur Ulfeldt Nov 12 '13 at 01:37
0

If you want to run clojure Ring handlers with Nginx without any Java Web Server, eg. Jetty. please try Nginx-Clojure module.

xfeep
  • 1,091
  • 11
  • 12