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
Luminus
framework and added this toLuminus
framework'smiddleware.clj
:and change
app-routes
inhandler.clj
to this:the
proxy-map
may be like this:and it works. However, when using this framework, I do not need to
cider-jack-in-clojurescript
any more and the web page are reloaded whenever I save my .cljs files. So just add any cross site route toproxy-map
and 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.