So I am trying to make http calls from my ionic application to another application running on tomcat apache serve however I think due to CORS issue the calls are not being successful. I followed the instructions on this site http://blog.ionic.io/handling-cors-issues-in-ionic/ with no luck. I am running the the tomcat apache application on http://localhost/platform/ and the ionic application on localhost:8100 I added this to my ionic.project:
{
"name": "mobile",
"app_id": "",
"proxies": [
{
"path": "/platform",
"proxyUrl": "http://localhost/platform/",
}
]
}
Added this also to my gulpfile.js:
gulp.task('install', ['git-check'], function() {
return bower.commands.install()
.on('log', function(data) {
gutil.log('bower', gutil.colors.cyan(data.id), data.message);
});
});
gulp.task('git-check', function(done) {
if (!sh.which('git')) {
console.log(
' ' + gutil.colors.red('Git is not installed.'),
'\n Git, the version control system, is required to download Ionic.',
'\n Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.',
'\n Once git is installed, run \'' + gutil.colors.cyan('gulp install') + '\' again.'
);
process.exit(1);
}
done();
});
I also added this line to my app.js:
.constant('appBaseUrl', 'http://localhost:8100/platform')
This is the http call I make:
$http({
method: 'post',
url: appBaseUrl + '/j_spring_security_check',
params: {
'j_username': credentails.username,
'j_password': credentails.password
}
})
However, the console can’t GET the loginsuccess.json which is the response to a successful authentication with the backend server on tomcat. Here is the response on the console http://s16.postimg.org/m2ua3kqc5/console.png
I have spent an entire day trying to make this work with no luck. Btw the specifications of proxy and proxypass for http://localhost/platform/ are defined on the httpd.conf file in the apache folder