1 (edited by Ratzfatz 2010-02-12 00:23:50)

Topic: Crossdomain.xml: consider FREE Google App Engine as workaround

I'm really unsure about whether or not this "story" will be of any use for anyone..., but then again, there's plenty of space on the forum's harddisk. So here it is:
A) in short words
I failed to use a FREE Google App Engine Website as a proxy for LoadVars.load()- and XML.load()-requests from sites without appropriate crossdomain.xml.
But may this work for You !?

B) the long story (yawn)
Like many other widget developers out there, I came across the need to get something via http using Actionscript's
LoadVars.load("http://....")
or
XML.load(...)
For the SearchTube, e.g.

  • I first fetch an XML-document with a list of video entries matching the search-string or category. I fetch this via XML.load("http://gdata.youtube.com...") using the official YouTube API. No problem here: type " http://gdata.youtube.com/crossdomain.xml" into your browser's address field and you'll see that they grant access from everywhere.

  • I then try to get a specific detail, the "token", for the one clip that the user selected. This request goes to "www.youtube.com" and fails, because www.youtube.com/crossdomain.xml restricts access to requests coming from "*.youtube.com" and "s.ytimg.com".

Without the token, the clip can only be played using YouTube's embedded player, which is much slower compared to playing the clip via Actionscript's Video Class.
A possible solution for this problem is to use a proxy-application located at a website with an appropriate crossdomain.xml. I read about this cgi-app that's executed by Chumby's inbuilt Webserver many times here in the forum (and in the end, I had to adopt this solution). The real drawback of this is that, though many Chumby-owners might be interested in your widget, they may not be willing to upload something to their chumby just to make your widget work.

So I thought: why not "outsource" this proxy-application to a free Google App Engine Website ? With this service, you can have server-side java or python-applications running in a sandbox on http://yourappname.appspot.com. All you need is a google-mail account. Great! And you get an enormous amount of webtraffic, CPU-Usage and Diskspace all for FREE!! Since I only planned to redirect a few short http-requests/replies (not the video-data!) of those few chumby-users using Search-Tube, quotas would surely not be the problem.

O.k., so I downloaded the SDK (for python), went through the very easy tutorials, started the Google App Engine Launcher (GL), edited the example python app "Main.py" to fit my needs (you can use urllib2() to redirect the request), and very quickly I had a working proxy-app. I tested it successfully on my Desktop-PC ( the SDK comes with a webserver that runs locally on your PC, no need to configure anything, you just press the "Start"-Button). Then I "deploy"ed the app into Google's [buzzword-warning!] "cloud".
It did not work there.

Using the "Dashboard" of the GL, I saw that www.youtube.com returned "HTTP error 402: Payment required" when confronted with the request originated on myappname.appspot.com!
I replaced "www.youtube.com" with other domains, and all worked fine, but I could imagine, that other websites not interested in "concentrated" traffic from xxx.appspot.com also deny access from there.

So draw your own conclusions.
Have fun!

Re: Crossdomain.xml: consider FREE Google App Engine as workaround

I think that is very nice according to me.......There are many different topics available here so I hope that you will read care fully and take more information......

Re: Crossdomain.xml: consider FREE Google App Engine as workaround

i'm a little late but thanks for the heads up.

did you manage to get it working with App Engine or did you go to another host?

i'm woking on a widget and i'm in a similar situation without a cross-domain on the remote server

Re: Crossdomain.xml: consider FREE Google App Engine as workaround

I did not manage to use Google's App Engine as proxy for Google's Youtube - I think Google knows how to protect from this kind of misuse. But I don't see a reason why you shouldn't be able to use App Engine as proxy for other services. For my purpose it didn't work, so I had to use a local script on the chumby as proxy.

Re: Crossdomain.xml: consider FREE Google App Engine as workaround

thanks for the response.

I had to use Quercus because App Engine does not directly support PHP but so far everything is working great.