My CORS configuration doesn't seem to work. Is there a way to log traffic? I have this:
devServer.proxy."/ecm".logLevel: 'debug'
devServer.proxy."/ecm".error: function(err, req, res) {
console.log(err)
}
devServer.proxy."/ecm".onProxyReq: function (proxyReq, req, res) {
console.log('RAW Request from the target', JSON.stringify(proxyReq.headers, true, 2));
}
devServer.proxy."/ecm".onProxyRes: function (proxyRes, req, res) {
console.log('RAW Response from the target', JSON.stringify(proxyRes.headers, true, 2));
const header = proxyRes.headers['www-authenticate'];
if (header && header.startsWith('Basic')) {
proxyRes.headers['www-authenticate'] = 'x' + header;
}
}
and in wsrv-config.js:
"proxy": {
"/ecm/{p*}": {
"options": {
"uri": "http://0.0.0.0:8082/{p}",
"verbose": true
}
},
But, no messages appear on the console.
8082 is alfresco community 6.x (for testing), but nothing appears in the access log
What version of ADF are you using? The 1.9 and 2.0 are using Angular CLI and its webpack dev server.
It is 1.9. In my post it shows how I am configuring webpack dev server. But I shortened some of it for the post.
devServer: proxy."/ecm"
is actually
devServer: {
proxy: {
"/ecm": {
...
}
...
}
...
}
You should get a working example if you generate a new 2.0.0 app with latest yeoman generator. You can also generate to a separate folder and compare the configurations.
Hi did you get a look to https://community.alfresco.com/community/application-development-framework/blog/2017/06/20/adf-cors-... ?
This a reply to Denys also. Yes,ADF CORS solving strategies is one of the articles I based the configuration on.
The yeoman generator does create a working example for me. I was also looking into the demo-shell in alfresco-ng2-components and before posting this question it was the demo shell I was having trouble with.
In the yeoman generated app, changing the log level in proxy.conf.json to debug was enough for me to figure out my immediate problem.
I would like to know how to log network traffic of the proxy with the angular-cli based app, but I am going to continue with the yeoman generator.
You can also check the "serve" command docs from the Angular CLI: serve · angular/angular-cli Wiki · GitHub You most probably need the "verbose mode". You can modify the "package.json" script (the "start" one) with extra switches. Hope that helps.
Discussions, help and advice about the Alfresco Development Framework.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.