Created
May 22, 2017 13:57
-
-
Save lukaszkorecki/2d020f14ceeecf78efb93eb147411960 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[aleph.http :as http]) | |
(require '[ring.middleware.cookies :as cookies]) | |
;; serv is a component which wraps aleph.http.server creation/teardown | |
(def ECHO (component/start (serv/create "ECHO" {:port 3037 | |
:handler (fn [req] | |
(log/info req) | |
{:status 200 :body "ok" })}))) | |
;; (component/stop ECHO) | |
(def PROXY (component/start (serv/create "PROXY" | |
{:port 3000 | |
:handler (fn [req] | |
(log/infof "REQ to proxy %s" req) | |
(http/request {:method (:request-method req) | |
:url (str "http://localhost:3037" (:uri req)) | |
:headers (dissoc (:headers req) "host" "content-length") | |
:follow-redirects true | |
:throw-exceptions false}))}))) | |
;; (component/stop PROXY) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment