2 Replies Latest reply on Jul 9, 2013 6:13 PM by Josh Osgood

    jsonp, gzip compression issues?

    Josh Osgood Newbie

      Howday RHQ community,

       

       

      I'm writing some javascript that needs to make a cross-domain request to an RHQ server (via REST API) that's hosted on another machine. For this reason, I've decided to use jsonp instead of ajax.

       

      What I've noticed is that my requests have been returning 200 OK, but fail to parse due to (presumably) gzip compression issues.

       

      When I try to access these jsonp endpoints from the browser, I get Error 330 (net::ERR_CONTENT_DECODING_FAILED): Unknown error. I've tried disabling gzip compression in firefox, and that seemed to fix the problem.

       

      Anyway, I was just wondering if others were able to reproduce this, or if it's just an issue with my particular installation.

       

      (Quick test: <RHQ-ADDRESS>:<RHQ-PORT>/rest/resource/platforms?jsonp=test - should return json of your platform information embedded in a javascript function)

       

       

      Gratzi,

       

      Josh

        • 1. Re: jsonp, gzip compression issues?
          Heiko Rupp Master

          Hi,

           

          interesiting, but I think what you see is a real bug:  the server prozesses the request in a servlet that calls the backend. This servlet also does the gzip compression. Now a filter is applied on the result (that may be gzipped) to wrap it in the javascript function.

           

          Could you open a BZ for this.

           

          I think the filter needs to disable the "Accept gzip" header if jsonp is requested - until we find a better way.

           

          Thanks

               Heiko

          • 2. Re: jsonp, gzip compression issues?
            Josh Osgood Newbie

            Thanks Heiko - your patch seems to have done the trick.

             

            For the record - if anyone is running into similar problems with jsonp, disabling gzip compression in firefox was a viable temporary fix. Just remember to re-enable it after patching.

             

            Josh