--- layout: doc title: Migration from Jetty ---
HTTP Kit is an almost drop-in
replacement for the standard Ring Jetty adapter,
just replace run-jetty
with run-server
.
Few differences:
http-kit relies on reverse proxy (like Nginx, Lighthttpd) to support HTTPS. They also can be used as a reverse proxy to serve static files and compress content.
Hitch is another option. It works well with websockets and long polling.
Sample configration for Nginx:
{% highlight sh %} server { listen 443 ssl; ssl on; ssl_certificate /etc/nginx/ssl/xxxxx_ssl.crt; ssl_certificate_key /etc/nginx/ssl/xxxx_ssl.key.nopasswd; location / { # http-kit listens on port 9090 proxy_pass http://127.0.0.1:9090/; proxy_set_header Host $http_host; } } {% endhighlight %}Hot code reload is very handy, with the Jetty one you can do something like:
{% highlight sh %} lein ring server # https://github.com/weavejester/lein-ring {% endhighlight %}lein-ring does not yet support http-kit, but
ring.middleware.reload
can be used as a workaround.
Page not found.
")) ;; all other, return 404 (defn in-dev? [&] true) ;; TODO read a config variable from command line, env, or file? (defn -main [& args] ;; entry point, lein run will pick up and start from here (let [handler (if (in-dev? args) (reload/wrap-reload (site #'all-routes)) ;; only reload when dev (site all-routes))] (run-server handler {:port 8080}))) {% endhighlight %}