Wednesday, November 16, 2011

Phonegap | Whitelist rejection in phonegap compilation with Xcode

While having an other domain server based service. Our phonegap application failed with ERROR logs :
whitelist rejection in phonegap compilation
The solution is to Whitelist (allow) the host to be accessible via phonegap, to accomplish it
In Phonegap.plist file,
Add new row to External Host (Key value pair)
for value, put your host name : (SERVER.COM).
1) ERROR whitelist rejection: url('http://localhost:XXXX/myproject/index')
Type: localhost in value column for for External Host
2) ERROR whitelist rejection: url('')
Type: myserver in value column for External Host

May be putting "*" , the asterisk as a value of the host that references an external URL , will do the trick. but not safe.
hope this helps, It works great for us :)

see my comments below for more info, as phonegap is cordova now!


  1. Thanks! :) it worked perfetly after adding .com and a star prior the hostname.

  2. I have tried all the difference versions of External hosts but still do NOT get around this Whitelist rejection. (ERROR whitelist rejection: )
    Are there any unknown issues in XCode 3.2.6 and PhoneGap 1.4.1 that explains this.
    Tried *.*, *[domainname].*, *, *.[domainname].com
    The simulator (iOS4.3) can connect to the internet.. it is just my app that cannot.
    Doing a basic Jquery Ajax call.

  3. hmm, just try to put SERVER_HOST_NAME of which server host you are trying to connect. e.g. "google" for

    If you still have trouble:
    Better will be to send the code to me, so that I can look into.

    Feel free to reach me via Skype "garg.praveen" or email "".


  4. I found the problem. In the Xcode editor it is easy to add the ExternalHosts as an extra row, and not as a subset of the External Hosts node...
    I should have edited the file with a text editor rather.

  5. btw, if we need to allow multiple hosts to be connected And we want to add only specific host names (NOT any of the external hosts i.e. *) THEN we should add them as a subset of the External Hosts node.

    Hope! It make sense.

  6. Phonegap is actually the part of Apache foundation now, and they named it as Cordova (intially apache callback). so there shall be a Cordova.plist now. and we need to make changes in that plist.

    As per the documentation.
    The latest (Cordova) code has the new white-list feature. If you are referencing external hosts, you will have to add the host in Cordova.plist under the "ExternalHosts" key. Wildcards are okay. So if you are connecting to "http://'", you have to
    add "" to the list (or use the wildcard "*" which will match subdomains as well).

  7. Hello Sir, Really your blog shorted out my problem. Since the very beginning day I was facing this error in Cordova framework. Thanks a lot!!!

  8. thanks a lot for this blog. thanks a ton..dinesh

  9. Got a question, I'm running Xcode 4.3.2 now with 1.7.0 PhoneGap. I've tried all versions of this and still it isn't working, due to the upgraded versions (started at this version) is there a different way of going about this? Also, when adding a new value does the Type need to be "String"?


  10. This comment has been removed by the author.

  11. @Billy,

    Can you please send that plist via email/dropbox? My email id is (
    Yes, you need to Add host value as a String node (chile node) of ExternalHost (parent node of type array)...

  12. Good work, extremely helpful!

  13. Thanks ! That helped !

  14. Hi nice to meet you Praveen.I still cant fix it.let say my url is not start with "www" .eg:"" what shall i put i the value string.i try add * still dint work. please help me out of this.
    thank you

    1. Try
      * Here abc is main domain name.

      *.* (in case, you see some challenge in FIRST case)
      Hope this will solve your issue.