I have got the following ajax request in Framework7 in order to get back json data in FW/1 (4.2) (Lucee 5.2.9), but unfortunately i get error due to CORS policy via Chrome browser.
app.request({
url:"http://127.0.0.1:49820/index.cfm/user/login/",
type:"POST",
data:JSON.stringify({
"username":username,
"password":password
}),
crossDomain: true,
xhrFields: { withCredentials: false },
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods':'GET,HEAD,OPTIONS,POST,PUT',
'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept, Authorization',
'Content-type': 'text/javascript; charset=utf-8',
},
dataType:"jsonp",
success:function(result){
console.log(result);
}
});
In my Fw/1 Application.cfc, i have got the following settings:
variables.framework = {
preflightOptions = true,
generateSES = true,
routes= [
{ "$POST/user/login/" = "/main/get" }
]
};
and in my main Controller get action i get json via
rc.user_info = variables.userService.login(rc.dsn,rc.username,rc.password);
variables.fw.renderData( "json", rc.user_info);
Unfortunately i receive the following message
Access to XMLHttpRequest at 'http://127.0.0.1:49820/index.cfm/user/login/' from origin 'http://localhost' has been blocked by CORS policy: Request header field access-control-allow-origin is not allowed by Access-Control-Allow-Headers in preflight response.
Regarding request-header information, i receive the following and as far as i can see parameters are also passed:
Any idea that could help me?
Regards