As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
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-a518-63d6aef4c4ac/renditions/pdf/content?attachment=false&alf_ticket=TICKET_3ffe3dc95c3a98a6442c73c874ee1f4a2ccca089 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.0If 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?
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.
Details
Network tab capture
Request URL: https://o-alfresco.vmm.be/alfresco/api/-default-/public/alfresco/versions/1/nodes/1370f78d-0eb0-4ddf-bfdf-69be0803eb67/renditions/pdf/content?attachment=false&alf_ticket=TICKET_994a22cb59b72a8a5849bb88b051256b12d21643Request Method: GETStatus Code: 401 UnauthorizedRemote Address: 192.168.130.117:443Referrer Policy: no-referrer-when-downgradeAccess-Control-Allow-Credentials: trueAccess-Control-Allow-Origin: https://o-dms.vmm.beContent-Length: 360Content-Type: text/html;charset=UTF-8Date: Mon, 17 Sep 2018 13:24:27 GMTServer: webserverSet-Cookie: JSESSIONID=B35178E11C94A8CE9C8E75181863F001; Path=/alfresco/; HttpOnlyVary: OriginWWW-Authenticate: NegotiateAccept: */*Accept-Encoding: gzip, deflate, brAccept-Language: nl-NL,nl;q=0.9,en-US;q=0.8,en;q=0.7Connection: keep-aliveHost: o-alfresco.vmm.beOrigin: https://o-dms.vmm.beReferer: https://o-dms.vmm.be/dms/vergadersite/vgd-test-vergadersite/vergadering/be6c3e3d-58d1-4629-b838-6601754959d4/verslag-bekijken/1370f78d-0eb0-4ddf-bfdf-69be0803eb67User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36attachment: falsealf_ticket: TICKET_994a22cb59b72a8a5849bb88b051256b12d21643
There are no js errors.
Have you tried same request with Postman? to check if your Tomcat is correctly configured and URL indeed works?
Hi Denys,
I tried it now. The request works fine with Postman. I get a pdf with the content of the document.
it looks like your configuration issue in tomcat could you maybe try to follow this guide :
Enabling CORS in Apache
Sorry but I am not able to replicate this problem it could be maybe simple if you provide something to try
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.
We use ADF apps internally with different servers and have not had any issues so far. I'm afraid we still need steps to reproduce it.
Can you try to replicate the issue with Alfresco Content Application? GitHub - Alfresco/alfresco-content-app: Alfresco Example Content Application
We don't support demo shell, so please also consider using Yeoman generator to create a fresh app and document steps to reproduce the problem (ADF 2.5.0 and ACS 5.2.3 or 6.0.x)
Hi, David has Denys says we run different apps more than once a day with more than 700 e2e test that target also the viewer.
So far those apps are no highlighting any of your problems.
I also checked it manually on the server and they are working fine .
It is for sure your local configuration problem. My suggestion as Denys sasys is recreating a sandbox example with your configuration starting maybe from the example content app.
If you can recreate this error in a sandbox app that I can try exaplaing the step I guess we can help you better
Hi,
As Denys recommended, I downloaded the Alfresco Content Application: GitHub - Alfresco/alfresco-content-app: Alfresco Example Content Application. I am using ACS 5.2.3.
These were the steps:
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0" metadata-complete="true">
--> 401 on opening a document preview
Thanks for the details. We will try to reproduce it locally.
Meanwhile, could you please test the configuration where base href is "./" ?
npm run build -- --base-href ./
Thanks.
Same result with --base-href ./
Maybe you could also see if you can reproduce that using ACS 6 and Tomcat 8?