XMLHttpRequest cannot load "xyz.com" Invalid HTTP status code 404 for POST angular js


#1

Hello All,

I have been getting the below error when I run the ionic app for POST to a server. The inspect element in chrome shows:
Failed to load resource: the server responded with a status of 404 (Not Found) http://www.XXXXXX.com/XYZ
XMLHttpRequest cannot load http://www.XXXXXf.com/XYZ. Invalid HTTP status code 404

We tried adding the headers as suggested on forums:
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Headers “Origin, X-Requested-With, Content-Type, Accept”

But keep getting the same error. It works fine in Apple iPhone’s chrome. This error is occurring in android chrome and also desktop (without disable web security)


#2

Did you ever sort this out, I’m having the same issue. I can use any client / jquery and I get results, but I’m receiving the same XMLHttpRequest cannot load http://www.XXXXXf.com/XYZ5. Invalid HTTP status code 404

thanks


#3

I fixed this issue by adding headers: Content-Type: undefined

var promise = $http({ 
		method: 'POST', 
		url: 'http://xyz.com',
        data: data,
        transformRequest: formDataObject,
        headers : {'Content-Type':undefined,}
		
	})