Parse-server: Unable to connect to the Parse API after implement ssl (HTTPS)

Created on 20 May 2016  路  10Comments  路  Source: parse-community/parse-server

I am using self hosted parse-server and not able to use cloud functions since I have enabled HTTPS, if I revert it back to HTTP it works as expected.

Also he problem is only with those cloud function which have Parse.Query, if i create a function simply return "Hello" as response it works on both HTTP and HTTPS.

I am getting following error message when run a cloud function which have Parse.Query code.

{
"code": 141,
"error": "XMLHttpRequest failed: "Unable to connect to the Parse API"--100"
}

can anyone tell me how can I fix this?

Most helpful comment

I'm having the same problem. After enabling SSL, clients can't communicate with the Parse Server anymore. The Parse Dashboard can't connect either, whether I configure it to use the public https endpoint, or "http://localhost/parse" or even "http://localhost:1337/parse".

Also, if I ssh into the instance that's running the parse server and the dashboard, and I try to curl our public endpoint with ssl (https), it works perfectly. I can even do REST API calls to the Parse Server and it answers them.

IMHO this is a bug in the Parse JS SDK. The common thing between the Parse Dashboard and the clients is that both use it.

All 10 comments

Did you also change the serverURL setting to match the new address?

yes I have changed serverURL to https

I'm having the same issue. Though I'm not sure this is an issue at all, since you specify http://localhost:1337/ anyway.

yes i have the same problem my app work's only on http

I'm having the same problem. After enabling SSL, clients can't communicate with the Parse Server anymore. The Parse Dashboard can't connect either, whether I configure it to use the public https endpoint, or "http://localhost/parse" or even "http://localhost:1337/parse".

Also, if I ssh into the instance that's running the parse server and the dashboard, and I try to curl our public endpoint with ssl (https), it works perfectly. I can even do REST API calls to the Parse Server and it answers them.

IMHO this is a bug in the Parse JS SDK. The common thing between the Parse Dashboard and the clients is that both use it.

Hello

@drew-gross kindly advice ?

Regards

This sounds like an SSL setup issue that might be better suited to Server Fault. There are definitely people out there using Parse Server and Parse Dashboard over SSL, so I don't think it's a bug.

Hello

@brocoli @andrew8712 can you please ask about the ssl setup for parse server in Server fault and get the required details for that based on @drew-gross advice ?

Regards

Hello, I have the exact same issue as @w3care25 and can't figure out what is our setup error :

  • My parseServerUrl is configured to https://www.my-domain.com:443/parse
  • All api calls from the outside of the server work perfect. For example I can send a GET REST API on https://www.my-domain.com:443/parse/classes/MyClass/id and this works. Also simple calls from the javascript sdk configured to the same https url work.
  • But any call from the inside of the server (inner Cloud Function query for example) fails with this error : XMLHttpRequest failed: "Unable to connect to the Parse API"

@drew-gross You suggested that this is a SSL setup issue, but it seems that this is not the case, and that the problem comes from the parse-server not being able to access securely an url that is accessible successfully from the outside.

How do you configure SSL? nginx? apache? node.js? In all of those cases, you may wanna set publicServerURL to the https and serverURL to the http. Loopback for cloud code should go thought http to avoid the ssl overhead.

In all these scenarios, you need 2 configuration, 1 configuration for the HTTPS another for the HTTP. Please refer to node, nginx or apache configuration.

For node: https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener and https://nodejs.org/api/http.html#http_http_createserver_requestlistener, in that scenario (that I don't personally recommend), you have to run both on 80 and 443 and run node as root (which is BAD).

For nginx: Reverse proxying and SSL (note that in that example, you should use an http upstream, using the 1337 port over HTTP)

For apache: https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension

My parseServerUrl is configured to https://www.my-domain.com:443/parse

You should strip 443 as https would automatically reach that port

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lorki picture lorki  路  3Comments

dpaid picture dpaid  路  3Comments

dcdspace picture dcdspace  路  3Comments

omyen picture omyen  路  3Comments

ViolentCrumble picture ViolentCrumble  路  3Comments