Search code examples
iosnode.jsmongodbparse-server

Parse Server Will Not Connect to Self-Hosted


I have a Ubuntu parse server hosted with MongoDB, I got my database switched over, and everything looks good. Parse Dashboard, able to get to the ports. But now when I try to get my app to start loading from there, it does nothing. I get a blank white screen and thats it. Even though all the data is now loading from my parse server self hosted anyways.

I have checked that everything is running right, port 1337 is npm start from the parse server.

This is the code I'm using:

let parseConfiguration = ParseClientConfiguration(block: { (ParseMutableClientConfiguration) -> Void in
        ParseMutableClientConfiguration.applicationId = "inSparkle"
        ParseMutableClientConfiguration.clientKey = "CLIENT_KEY"
        ParseMutableClientConfiguration.server = "http://10.0.1.9:1337/parse"
    })

    Parse.initializeWithConfiguration(parseConfiguration)

Any help would be greatly appreciated! I am really confused by this because 10.0.1.9:1337 says "I dream of being a website. Please star the parse-server repo on GitHub!"

Mongo is running, as well as dashboard all on their own ports. I can even access the dashboard from the iPad I'm testing with. Just not my app.


Solution

  • My guess is that iOS blocks your calls to Parse because the connection to your server is not secured (by default, iOS prohibits any HTTP connections without SSL/TLS encryption).

    For testing purpose, you can add this to your Info.plist:

    <key>NSAppTransportSecurity</key>
    <dict>
      <key>NSAllowsArbitraryLoads</key>
      <true/>
    </dict>
    

    In the production build, NSAllowsArbitraryLoads should of course not be enabled, instead you should access Parse over a secure connection.