Forums/Community/Zendesk Apps

Proxied AJAX requests violates HTTP end-to-end principle

Thomas Balsløv
posted this on September 14, 2012 04:54

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.

 

Comments

User photo
James Rosen
Zendesk

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.

September 14, 2012 23:56
User photo
Thomas Balsløv
panorama9

Hi James.

OK, no problem :o)

Thomas.

September 17, 2012 03:15
User photo
Denis Manente
novatrend

+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
October 11, 2012 05:05
User photo
James Rosen
Zendesk

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

October 13, 2012 09:51
User photo
Sebastiaan Wijchers
mediacompetence

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

November 15, 2012 04:50
User photo
Lukas Schönbächler
coresystems

Hey James,

 

Is there any progress on this issue?

November 21, 2012 06:26
User photo
Jake Holman
Product Manager

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.

November 26, 2012 12:59
User photo
Peter Huang
practiceevolve

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

January 30, 2013 18:13
User photo
Sebastiaan Wijchers
mediacompetence

@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...

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.

January 31, 2013 00:20
User photo
Maxime
Product Manager

Hi guys

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

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

May 27, 2013 16:25
User photo
Maxime
Product Manager

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

July 12, 2013 14:05
User photo
Peter Huang
practiceevolve

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

July 12, 2013 21:18
User photo
Maxime
Product Manager

Peter

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

Thanks

Maxime

July 13, 2013 12:10