cancel
Showing results for 
Search instead for 
Did you mean: 

adf-viewer causes 401 after deploy

d_moeyersons
Star Contributor
Star Contributor

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?

17 REPLIES 17

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)

eugenio_romano
Elite Collaborator
Elite Collaborator

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 

d_moeyersons
Star Contributor
Star Contributor

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:

  • Unpack alfresco-content-app-master.zip
  • Edit /proxy.conf.js and change the following values:
proxy.conf.js
 "target": "https://o-alfresco.vmm.be",
 "secure": true,

--> the document preview works correctly
  • Edit /package.json and change the following value:
package.json
 "build": "npm run server-versions && npm run build.libs.prod && node --max-old-space-size=8192 node_modules/@angular/cli/bin/ng build app --prod --base-href /test/",
  • Run: npm run build
  • Edit /dist/app/app.config.json and change the following value:
app.config.json
 "ecmHost": "https://o-alfresco.vmm.be",
  • Create the file: /dist/app/WEB-INF/web.xml with the following content:
web.xml

<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">

   <display-name>ADF Test</display-name>
   <description>
  ADF Test
   </description>
  
   <error-page>
  <error-code>404</error-code>
  <location>/index.html</location>
   </error-page>
 </web-app>

--> 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?

Hi Denys,

The 401 error doesn't come up with ACS 6 & Tomcat 8, the preview is shown.
It would be nice for us if ACS 5.2.3 would work too. We currently have a few reasons not to upgrade to ACS 6.

David.

Good to hear that ACS 6 is working. You can also verify you have everything configured for the old tomcat version (Angular Docs) and create a support ticket to get it sorted out for 5.2.3 and tomcat 7