Ver Mensaje Individual
  #5 (permalink)  
Antiguo 16/12/2019, 09:10
Avatar de Hyemin
Hyemin
 
Fecha de Ingreso: agosto-2014
Mensajes: 147
Antigüedad: 9 años, 8 meses
Puntos: 0
Respuesta: Error con CORS en API REST

Cita:
Iniciado por prueba230683 Ver Mensaje
En el código del primer post:

Código Java:
Ver original
  1. .header("Access-Control-Allow-Headers: 'application/json'",
  2.         "origin, content-type, accept, authorization")

creo que debería ser:

Código Java:
Ver original
  1. .header("Access-Control-Allow-Headers",
  2.         "origin, content-type, accept, authorization")


Gracias por la respuesta, acabo de probar eso y sigue sin funcionar :( da el mismo error de CORS
Código:
Access to XMLHttpRequest at 'http://192.168.38.7:8080/rest2/webresources/login' from origin 'http://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
core.js:6014 ERROR
Código:
zone-evergreen.js:2952 Cross-Origin Read Blocking (CORB) blocked cross-origin response http://192.168.38.137:8080/rest2/webresources/login with MIME type application/vnd.sun.wadl+xml. See https://www.chromestatus.com/feature/5629709824032768 for more details.