Request headers not sent from Service Worker

耗尽温柔 提交于 2019-12-03 15:55:12

You should set as allowed headers also accept and authorization

response.setHeader(
  "Access-Control-Allow-Headers", 
  "x-requested-with, accept, authorization"
);

also body of the response for "OPTIONS" request should be empty (it is not necessary indeed, but there is no use case for body in such response) and Content-length: should be 0 (zero)

Please note, that this request should not be passed to application (you can, but not need)

Pass {"credentials": "include"} as the param to the fetch() call.

https://fetch.spec.whatwg.org/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!