我能够发送一个http请求并获得成功的共鸣,但是当我通过HTTPS发送请求时,我收到以下错误POST “https://..../request/addimage net :: ERR_INSECURE_RESPONSE” < / p>
这是我的代码
.controller('imageCtrl', function ($scope, $cordovaCamera, $ionicLoading, $http, $ionicPopup, $ionicPopover, $state, userService, $ionicSideMenuDelegate, $rootScope, $cordovaDevice) {
var imageX; //save the base64
$scope.takePhoto = function(){
var options = {
quality: 50,
destinationType: Camera.DestinationType.DATA_URL,
sourceType: Camera.PictureSourceType.CAMERA,
allowEdit: true,
encodingType: Camera.EncodingType.JPEG,
targetWidth: 50,
targetHeight: 50,
popoverOptions: CameraPopoverOptions,
saveToPhotoAlbum: false,
correctOrientation:true
};
$cordovaCamera.getPicture(options).then(function(imageData) {
imageX = imageData;
}, function(err) {
// error
});
};
$scope.uploadPhoto=function(){
var uuid = $cordovaDevice.getUUID();
var dataj ={
image:imageX,
device_id:uuid,
picture_format:"jpg"
};
$http.post('https://..../request/addimage',dataj)
.success(function (data) {
//success
}).
error(function (data, status) {
//error
});
};
})
答案 0 :(得分:0)
请求可能被阻止,因为正在请求的资源上的SSL配置出现问题。
我遇到了同样的问题,并通过在我通过HTTPS请求的资源上修复我的SSL链来解决它。尝试使用此站点来识别和解决SSL配置问题:https://www.ssllabs.com/ssltest/analyze.html