Обращаюсь через fetch к серверу на jetty.
Ответ содержит заголовки:
resp.addHeader("Access-Control-Allow-Origin", "*");
resp.addHeader("Access-Control-Allow-Methods", "PUT");
resp.addHeader("Access-Control-Allow-Headers", "Content-Type");
Но браузер выдает
Fetch API cannot load
localhost:8081/admin/country. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '
localhost:63343' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
index.html:1 Uncaught (in promise) TypeError: Failed to fetch
С GET работает нормально.
В чем причина такого странного поведения браузера?