The problem is that the servlet context is not part of the HTTP protocol, and the client isn't aware of it. So, you have to manually track this prefix in your application. To do that, you'd need to add a piece of middleware that injects the servlet context in the request, e.g:
(defn wrap-context [handler]
(fn [request]
(handler
(assoc request
:servlet-context
(when-let [context (:servlet-context request)]
;; If we're not inside a servlet environment
;; (for example when using mock requests), then
;; .getContextPath might not exist
(try (.getContextPath ^ServletContext context)
(catch IllegalArgumentException _ context)))))))
Then in the layout namespace, you'd want to read the :servlet-context key, and inject it in the page. The requests from the page have to prefix this context to the URL.