I have a Web Site (Angular 16). That's deploy in IIS 10 (HTTPS port 443 with a Certificate)
I have ARR enabled, and on my web site tengo a rewrite ruler.
My back-end is in Node.js. It's running in the same serv but in other port (3000), also with HTTPS and a Certificate.
No problem when call back-end para method POST. Is OK no problem.
The problem is when the web call a PUT method. Never reaches my back-end. I know that because I have the next code beginning my server.js (archivo principal in my back-end):
app.use((req, res, next) => { console.log(`Ruta recibida: ${req.url}`); next();});
Never reaches the PUT to my back-end because not print nada.
In the console Chrome. Say that: PUT rutacompleta 403 (Forbidden)
When I call the same PUT method with POSTMAN no problem, works OK. But the problem is when I use Chrome, I can't.
service code:
InactivarUsuario( usuario: Usuario, token: string): Observable<HttpResponse<any>> { const url = `${configGlobal.urlApiTerrenos}usuarios/actualizaestadovigenciausuario`; const headers = new HttpHeaders({ Authorization: `Bearer ${token}`, // Añade el token en el encabezado de autorización }); return this.http.put<any>( url, { usuario }, { headers, observe: 'response' } );}
component.ts code:
if (this.token) { this.usuarioService .InactivarUsuario(usuario, this.token) .pipe( catchError((error: HttpErrorResponse) => { if (error.status === 0) { this.messageConfirmationModal ='Problemas de Red, por favor, comunicarse con personal de TI'; } return of(null); }) ) .subscribe((data) => { if (data && data.status === 200) { if (usuario.vigencia === 'A') { this.toastr.success('El usuario ha sido activado con éxito.'); // Muestra el toast } else { this.toastr.success('El usuario ha sido inactivado con éxito.'); // Muestra el toast } this.buscarUsuarios(); } });}