Skip to content

response url of file.save() returns address of localhost instead of public url #1944

@manishsangwan

Description

@manishsangwan

My server is hosted on aws ec2 instance. I am using elastic load balancer. Load balancer is using https. I am using nginx to send all requests on https://mydomain/parse to http://127.0.0.1:1337/parse

when i used serverURL as https://mydomain/parse i was getting same problem as issue 411

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

so i modified serverURL to https://localhost:1337/parse . Things started working. but when i save a file object the url in response i get is http://localhost:1337/parse/files/my-app-id/filename instead ofhttps://mydomain/parse/files/my-app-id/filename. hope it made myself clear. my code segments are given below.

parse server configuration:-

var api = new ParseServer({
     ....
     serverURL: http://localhost:1337/parse,
     publicServerURL: https://mydomain/parse,
     ....
    });

file object:-

var file = new Parse.File('file-name.jpg', data);
file.save(function (response){
    console.log(response.url);     //gives http://localhost:1337/parse/files/my-app-id/filename 
  });                                          //instead of https://mydomain/parse/files/my-app-id/filename

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumedtype:questionSupport or code-level question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions