У меня проблема с Cors в хапи js.
я использую плагин hapi-cors
await server.register({
plugin: HapiCors,
options: {
origins: ['*'],
exposeHeaders: ['content-type', 'content-length'],
maxAge: 600,
methods: ['GET, HEAD, PUT, PATCH, POST, DELETE, OPTIONS'],
headers: ["Access-Control-Allow-Origin", "Access-Control-Allow-Methods","Access-Control-Allow-Headers", 'Accept', 'Content-Type']
},
checkOrigin: true
})
с
server.route(
{
method: 'DELETE',
path: paths,
handler: handlers,
options: validate,
},
)
, но на стороне клиента я получил ошибку
Access to XMLHttpRequest at 'http://localhost:3001/product/25919155' from origin 'http://localhost:3000' has been blocked by CORS policy: Method DELETE is not allowed by Access-Control-Allow-Methods in preflight response.