CORS request not working in Safari

后端 未结 13 1460
忘掉有多难
忘掉有多难 2020-11-27 06:04

I am making a CORS xhr request. This works fine in chrome, however when I run in safari I get an \'Can not load ---- access not allowed by Access-control-allow-origin\'.

13条回答
  •  -上瘾入骨i
    2020-11-27 06:47

    Set two response headers:

    1. Access-Control-Allow-Methods: '*', allow all

    2. Turns out server had Access-Control-Allow-Methods response header's value is set to *. It had to explicitly set to allow methods instead of a wildcard as it is not supported by a safari in iOS as given here in this MDN doc.

    https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods

提交回复
热议问题