仅限 Safari:Access-Control-Allow-Headers 不允许请求 header 字段 Cache-Control

Safari Only: Request header field Cache-Control is not allowed by Access-Control-Allow-Headers

$.ajax({
    method: "GET",
    url: "http://pokeapi.co/api/v2/pokemon?limit=151"
  }).done(function(data) {
    console.log(data);
  });

在 Chrome 中表现出色。

Safari returns:

Failed to load resource: Request header field Cache-Control is not allowed by Access-Control-Allow-Headers.

XMLHttpRequest cannot load http://pokeapi.co/api/v2/pokemon/?limit=151. Request header field Cache-Control is not allowed by Access-Control-Allow-Headers.

我试过 ajaxSetup beforeSend 使 "Cache-Control" 无效。

有什么想法吗?

您是否尝试过将请求更改为 https 而不是 http?就在昨天,这对我有帮助,但我删除了缓存,找不到我阅读的 mozilla 文档。我会尽力找到它 post 它

找到https://developer.mozilla.org/en-US/docs/Security/Mixed_content/How_to_fix_website_with_mixed_content