Hi everyone,

I've been working on a cljs app with reagent up front, and compojure behind 
doing redirects to a Spring Boot web service (I'm basically using compojure to 
get around CORS).  I had been developing this on  a local server with lein 
ring.  Since deploying it to a tomcat7 server I have run into an issue that I 
have been grappling with the past 3 days, with little to no progress (upside: I 
vaguely know what some of the google XhrIo code does now :D).  When I load the 
main page of the app, I see this after the attemted GET to 
compojure->webservice:

GET http://compojure/redirect/to/ws net::ERR_INVALID_CHUNKED_ENCODING

When I navigate the browser to an explicit redirect url (the one on the 
compojure side that does a GET to the web service), I see

Resource interpreted as Document but transferred with MIME type 
application/json: "http://compojure/redirect/to/ws";.
GET http://compojure/redirect/to/ws net::ERR_INVALID_CHUNKED_ENCODING.

I can hit the web service URL itself via the browser/cURL no problem.

When I attempt to cURL any of the WS endpoints via the redirect URL I get:

curl: (56) Received problem 2 in the chunky parser

There isn't a whole lot of documentation on this error in Google, but from what 
I've surmised, one party is expecting chunked transfer, and one is not.

I have tried checking the packets with wireshark, but it's kind of hard because 
it's on my work network and the traffic is encrypted.  I saw a couple of issues 
where people had extra \r\n 's in their requests, but again, it's kind of hard 
to check in wireshark.

I have tried changing response headers on the spring side to no avail:

Cache-Control: no-cache
Pragma: no-cache
Content-Type: text/html
Content-Type: text/html;charset=utf-8
Content-Type: application/json
Content-Type: application/json;charset=utf-8

After that I stopped monkeying with the headers in Spring.  I'd rather not set 
Content-Length and just use chunked transfer, if I could.

I also tried removing the wrap-json-body and wrap-json-response middlewares.

I believe my issue lies somewhere in the transfer of the returned JSON from 
compojure to the client.  I think this is so because I can see the response 
body if I do a println in my compojure route.

Here's the relevant cljs code that does the GET, using cljs-http 
(https://github.com/r0man/cljs-http):

(defn schema-owners
  []
  (let [c (chan)]
    (go  (let [response   (<! (http/get "/junk/owners" {:with-credentials? 
false})) 
               flat-owners (distinct (map :owner (:body response)))]
           (>! c  (sort flat-owners)))
         (close! c))
    c))

On the compojure side:

(GET "/owners" [] (table-owners))

(defn table-owners
 []
 (let [response (client/get (str base "/owners") {:debug true})]
   (println "response! " response)
   response))

I'm pretty much out of ideas at this point, and would really appreciate any 
advice/tips/ideas :D

Thanks,

Tom

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to