3

Proxied AJAX requests violates HTTP end-to-end principle

Hi Zendesk.

Using AJAX'ed HTTP requests from an App I found that when I send a HTTP status error from my web service, e.g. 400, the proxy ignores this and sends 200 OK.

The proxy should forward any HTTP status code returned by the external web service.
Not doing this makes error handling more complex in the App.
The AJAX ".fail" event is reduced to a "proxy_fail" event, and not a service fail event, which I think should be its purpose.

BTW: Thank you for an otherwise great App framework! 

Regards,
Thomas Balsløv.

13 comments

  • 0

    Hi, Thomas,

    You're right that ours is not a true pass-through proxy. We'll continue to improve the proxy over time. In the meantime, I've added a note to the list of known issues. Thanks for letting us know.

  • 0

    Hi James.

    OK, no problem :o)

    Thomas.

  • 0

    +1 on this feature

    I want to add that I'd like to see:

    • forwarding HTTP Status Code
    • forwarding same Content-Type
    • Allow all major Methods (GET, POST, PUT, DELETE) to support REST-API's
  • 0

    Those are all on our list, Denis :) (It's nice to know others care about HTTP semantics, too.)

  • 0

    Hey James,

    Is there any ETA on this?

    We send the Zendesk proxy to our own now, to make PUT and DELETE requests possible. Also the stripping of the headers makes certain authentication methods impossible. We add data to the initial POST/GET request, so our proxy knows when and what to manipulate.

    The workarounds are getting dirtier and are unnecessary. I'd love to see this fixed.

    Cheers,

    Sebastiaan

  • 0

    Hey James,

     

    Is there any progress on this issue?

  • 0

    At the moment I have no solid ETA on this. We will be re-writing our Proxy which should mean 95% of the issues being reported will be dealt with, but at this stage the project has not started.

  • 0

    In the mean time, is there anyway of getting a Ajax PUT request out to another domain?  Perhaps through another proxy script?

  • 0

    @Peter Huang; That's basically what I did (routing it through another proxy). I made a proxy which reverts some of the 'damage' the Zendesk proxy does. Like authorization issues when using the header and forming a POST request into a PUT request for the final end point.

    It's in PHP, I based it on a modified Simple PHP Proxy. I'm not really sure right now where I got it from, but I think it was this one:
    https://github.com/developerforce/Force.com-JavaScript-REST-Toolkit/blob/master/proxy.php

    If this is an option for you and you want to see my code, just let me know and I drop in my e-mail.

  • 0

    Hi guys

    We have released CORS support in Apps, please find documentation here : http://developer.zendesk.com/documentation/apps/reference/request.html#cors-support

    We are also actively working on a new version of our proxy, which will help with your problem. I'll make sure to keep this thread updated

    Let me know if there are any questions

    Maxime

  • 0

    Hi guys,

    We have now released our new proxy which should address most of the issues you were experiencing with the previous one, to see how to use this one simply follow this link:

    http://developer.zendesk.com/documentation/apps/reference/request.h...

    Let me know if you have any questions!

    Maxime

  • 0

    Hi Maxime,

    I'm still having trouble with this.  It appears the Content-Type may not be set correctly with a PUT request.  It seems to be set as URL encoded, when it should be XML.

    Are you able to confirm that?

    Regards,

    Peter

  • 0

    Peter

    Can you share the sample code from your request? I'd like to understand exactly where it's failing for you

    Thanks

    Maxime

Please sign in to leave a comment.