PDA

View Full Version : A way to specify allowed domains for Sencha's Proxy?



tt88
20 Aug 2013, 1:00 AM
Hi

I have a native sencha app which references services from my server at a specific domain.
Rather than using limited jsonp calls (I'm getting stuck having to write complicated code to do simple ajax calls for rest creates / updates) I would like to be able to interchangeably use ajax + json calls.

Is there a way to allow calls to a specific server domain in my Sencha app - and thus remove the requirement to use jsonp? (all my service calls will always live at that one particular domain)

I did find the following options:
- in the proxy setting useDefaultXhrHeader : false + on the server specify: response.setHeader("Access-Control-Allow-Origin", clientOrigin)
This option is not sufficient because I don't want to open up requests to any domain, only the particular one where my services reside.

Thanks
ttw

fmoseley
21 Aug 2013, 1:25 PM
With phonegap you can white list domains.
http://docs.phonegap.com/en/2.9.0/guide_whitelist_index.md.html#Domain%20Whitelist%20Guide

tt88
22 Aug 2013, 12:08 AM
With phonegap you can white list domains.
http://docs.phonegap.com/en/2.9.0/guide_whitelist_index.md.html#Domain Whitelist Guide

Thanks