In grunt/webpack/express, I can proxy some APIs from other domain/hostname to the current server on which the html page is served and solve the CORS problem.
I found the figwheel use ring to start a http server, then I think I can use https://github.com/tailrecursion/ring-proxy to add a proxy path to the figwheel server. But I don't know how can I do this outside the figwheel project.
Thank you!
I use the
Luminusframework and added this toLuminusframework'smiddleware.clj:and change
app-routesinhandler.cljto this:the
proxy-mapmay be like this:and it works. However, when using this framework, I do not need to
cider-jack-in-clojurescriptany more and the web page are reloaded whenever I save my .cljs files. So just add any cross site route toproxy-mapand using the corresponding key to access.For example, using
(GET "/www/some-path'")will works as if you are requesting(GET "https://www.example.com").Btw, most of these code are stolen from https://github.com/tailrecursion/ring-proxy and some other similar repos.