Reverse Proxy in shadow-cljs

I’ve broken my reverse proxy configuration in shadow-cljs multiple times, so I need a reminder for myself.

I have the server-side api running in a container, and the CLJS is running in shadow-cljs in dev mode.

With a :proxy-url set, shadow-cljs will forward any request it can’t match with a file in the root to teh other server. This helps avoid Cross-Site-Request-Forgery failures in the browser during development.

 :dev-http {3000 {:root "public"
                  :proxy-url "http://localhost:7000/my-backend-service"}}

The important part is to ensure the URL lacks the trailing slash. With the slash, I see lots of not-found errors from the backend server for everything but the default index.


Filed Under: Clojure Code Computers