When I upload a ParseFile
the link is changed to http for some reason. And because of this during the download the link goes to nginx which does a 301 redirect to https
. This results in a "moved permanently" exception in the Android code and the download fails. My upload code is below.
ParseFile file = new ParseFile("image.jpg", data);
file.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
if (e == null) {
Log.d(tag, "Successfully uploaded image file to: " + file.getUrl());
}
}
}
The Log.d
prints out this line,
Successfully uploaded image file to: http://<server_addr>/parse/files/<app_id>/b55beba96cab60cecea084365d1f2c3e_image.jpg
Here is my initialization code for parse.
Parse.initialize(new Parse.Configuration.Builder(this)
.applicationId("<app_id>")
.server("https://<server_addr>/parse/")
.build());
As you can see https
is clearly specified in the initialization code but the ParseFile url is http
. So I am not sure what to do to change this behaviour.
The issue was that I needed to set parseServerURL
variable when initializing the parse-server. Setting that as a https
url fixed everything.