View Full Version : CORS referring domain when packaged natively

20 Dec 2012, 7:45 AM
I'm weeks away (due to red tape) at wrapping my app up natively with Sencha and getting it installed on a device but I have a strong concern after recently completing CORS setup on my app and that is What will the referring domain be for Ajax request if an application is natively wrapped?

As I understand CORS, to access Web Services that require authentication one must set "withCredentials" to true and on the apache side you mention what domain(s) are allowed to access your site as such

Header set Access-Control-Allow-Origin http://localhost

as "wildcarding" is not allowed when you have withCredentials set to true in the Sencha app

When the app is simply a url like tablet.company.com the answer is very clear what the referring domain will be to the web service, it will be "company.com" but when it is natively wrapped and is opened via an icon on the iPad I don't have a clue what that referring domain will be. And further more am worried that it will be something random and unpredictable leaving me to scramble to create some sort of alternative to "withCredentials: true" because I will not be able to define those incoming domains for CORS to the WEB service.

Many thanks


22 Dec 2012, 7:17 AM
If you are in a packaged app then you won't be able to use CORS as you don't have a domain or a steady IP (unless you try to capture the IP and return it in your server side code for the header, not sure if that would work or not). I don't believe that Phonegap has the CORS issue but could be wrong.

26 Dec 2012, 8:28 AM
Yes, this will be a packaged app.

A little more clarity please, are you saying that with Sencha Native Packaged app I will not be able to perform POST or PUT request to a Web Service because CORS will cause errors?

And/Or are you saying that yes I will have CORS errors when attempting POST or PUT functions with Sencha native packaged app BUT if I use PhoneGap packaging these problems do not happen?


Kris Thompson