09-17-2018 06:13 AM
When I deploy my app to my webserver (Tomcat v7.0.59) when I try to preview any document (with adf-viewer), the document viewer doesn't show it and the console log shows a 401 error like this:
GET https://o-alfresco.vmm.be/alfresco/api/-default-/public/alfresco/versions/1/nodes/5c62ee00-6a32-4406... 401 (Unauthorized)
The link works if i copy it and open it in a new browser window. In development mode (npm run start) all the previews work fine. I only get a 401 on previews. CORS is configured and working fine, I get no CORS errors either.
The problem started after i updated my app from ADF v2.4.0 to v2.5.0
If i make a new ADF 2.5.0 app, and deploy it without code changes, i get the same problem.
Does anyone else have this experience or have an idea what could cause this?
09-17-2018 09:13 AM
Can you please provide any extra details, i.e. what are the browser error details in the Network tab. The stack traces if there's a JS error during that call, etc.
09-17-2018 09:40 AM
Details
Network tab capture Request URL: https://o-alfresco.vmm.be/alfresco/api/-default-/public/alfresco/versions/1/nodes/1370f78d-0eb0-4ddf... |
There are no js errors.
09-17-2018 09:44 AM
Have you tried same request with Postman? to check if your Tomcat is correctly configured and URL indeed works?
09-17-2018 09:54 AM
Hi Denys,
I tried it now. The request works fine with Postman. I get a pdf with the content of the document.
09-18-2018 06:05 AM
it looks like your configuration issue in tomcat could you maybe try to follow this guide :
09-18-2018 07:27 AM
Hi Eugenio,
I have tried this implementation that you mention before, both globally as wel as in the webapp, I have never gotten it working with Alfresco.
I currently use the CORS implementation that is commented out in the alfresco.war\WEB-INF\web.xml . It works fine. And there is no reason that it shouldn't work with the document viewer.
Also if there are CORS error: the console messages should mention it, it doesn't. And CORS is disabled in my Internet Explorer and MS Edge, and it also fails there, this is no CORS problem.
David.
09-20-2018 09:28 AM
I also tried it in Apache HTTP server, I got exactly the same error.
There is a difference between the call that causes 401 and the other calls.
CORS is active, the headers are returned (as you can see in the logs), so that is not the problem & CORS doesn't trigger 401.
But there is no Authorization header, instead a alf_ticket is added. Why is that?
David.
09-24-2018 10:06 AM
Sorry but I am not able to replicate this problem it could be maybe simple if you provide something to try
09-25-2018 03:10 AM
Hi Eugenio,
I did some more tests today, I only get the error because my Alfresco server and ADF app are on different servers.
(ADF runs on the same server as the share environment - We have one server for the database Postgres, one server for the Alfresco platform environment, one server for the Share and ADF environment)
When I upload the ADF app to the Alfresco platform (back-end) server, I get no errors.
I also checked the Alfresco logs for csrf errors when the 401 error shows up, i get no such errors.
Have you tried both the Alfresco platform server and the ADF client on one server, or have you tried it on different servers?
My current ADF app is created for a customized Alfresco server, it has several Java extensions especially made for our organisation, it won't work well on a standard Alfresco setup. But I get the same errors with the ADF demo application: alfresco-ng2-components/demo-shell at master · Alfresco/alfresco-ng2-components · GitHub
Let me know if that is enough or you need more information.
Thanks!
David.
Explore our Alfresco products with the links below. Use labels to filter content by product module.