I am writing a little demo web server delivering static html,css and javascript. The server looks like
(function () {
\"use strict\";
var http = req
The easiest method, if you are using gulp would be to use gulp plugin called "gulp-connect" and "connect-modrewrite" and define a new gulptask to redirect a particular api. This is to make the apache act as a Proxy for the particular api, to bypass the pre-flight request, inorder to avoid CORs issue. I used the following gulp task to overcome this problem.
var connect = require('gulp-connect'),
modRewrite = require('connect-modrewrite');
/**
* Proxy Config
*/
gulp.task('connect', function () {
connect.server({
root: ['./.tmp', './.tmp/{folderLocations}', './src', './bower_components'],
port: 9000,
livereload: true,
middleware: function (connect, opt) {
return [
modRewrite([
'^/loginProxy/(.*)$ http://app.xyzdomain.com/service/login/auth/$1 [P]'
])
];
}
});
});