I am using JSR 286 portlets and using serveResource() method to achieve AJAX call. Implementation works fine in my localhost server. But it does not work once deployed on application server. Below given is the architecture.
Below given is the code from client :
$.ajax({
url : '<portlet:resourceURL/>',
dataType: "xml",
data : {ssousername: user, passwordsrv : pass, ipRandomValue : ip, deviceTypeHidden : browserStringVar},
cache : false,
type : 'POST',
withCredentials:true,
crossDomain:true,
success : function(xml) {
// Success Logic
},
error : function (jqXHR, textStatus, errorThrown) {
console.log('Error Occurred' + errorThrown);
// Failure logic
}
});
On application server it gives an 403 error of forbidden. I think there has to be some configuration that needs to be done at OHS (apache 2). I tried with below configuration in OHS but it did not work.
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header always set Access-Control-Max-Age "1000"
Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"