cancel
Showing results for 
Search instead for 
Did you mean: 

Error 403 with PUT or DELETE http calls

FabioVaprio
Champ in-the-making
Champ in-the-making

I've installed Alfresco Community 7.3 with docker, and I'm developing a frontend application with Angular.

It use a Tomcat webserver. When I try to execute a PUT or DELETE http call, server send back the following error: "status: 403, statusText: 'Forbidden".

The routine is the following (eg. for delete a document):

sAlfEliminaFile(ticket: string, idFile: string){
    const headers = new HttpHeaders({
      'Authorization': 'Basic ' + btoa(ticket),
    });

    return this.http.delete('/alfrescoapi/-default-/public/alfresco/versions/1/nodes/22f98143-eb5e-48f0-8c40-4534c1fe73d1', {headers : headers })
  }

I'm using a proxy to avoid CORS problem, with following parameters:

{
    "/alfrescoapi": {
      "target": "http://localhost/alfresco",
      "secure": false,
      "pathRewrite": {
        "^/alfrescoapi": "/api"
      },
      "changeOrigin": true
    }
} 

I've already tried to change the param "changeOrigin" to false but it does not work. Credentials are corrects, I've also tried with admin credentials, with the same result.

What I can do to solve? Thanks.

5 REPLIES 5

angelborroy
Community Manager Community Manager
Community Manager

I guess the problem is that service doesn't exist.

I created a workaround in this project:

https://github.com/keensoft/alfresco-remove-version

It's required to create a new Web Script (legacy REST API) in Repository to handle this DELETE invocations:

https://github.com/keensoft/alfresco-remove-version/blob/master/remove-version-repo/src/main/resourc...

Hyland Developer Evangelist

I addition... review your URL, since it looks incorrect.

This is the right one:

'/alfresco/api/-default-/public/alfresco/versions/1/nodes/22f98143-eb5e-48f0-8c40-4534c1fe73d1'

With an additional slash between "alfresco" and "api"

Hyland Developer Evangelist

Thanks for your help,

the URL it's right, because I create an alias on proxy conf file

"pathRewrite": {
        "^/alfrescoapi": "/api"
      },

So, "alfrescoapi" is changed in "api". All'other API I developed work well.

Sorry, but I didn't understand your answer. May you explain me better?

This API is described in "Alfresco Content Services REST API" and the problem is the same for PUT method.

I solved by installing Alfresco on port 8080 instead of 80.

I don't know if NGIX reverse proxy has a specific rule for port 80.