12-14-2017 09:15 AM
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
12-14-2017 09:21 AM
What version of ADF are you using? The 1.9 and 2.0 are using Angular CLI and its webpack dev server.
12-14-2017 10:43 AM
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": {
...
}
...
}
...
}
12-14-2017 10:50 AM
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.
12-14-2017 11:03 AM
Hi did you get a look to https://community.alfresco.com/community/application-development-framework/blog/2017/06/20/adf-cors-... ?
12-14-2017 04:06 PM
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.
12-15-2017 02:31 AM
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.
Explore our Alfresco products with the links below. Use labels to filter content by product module.