Home  >  Q&A  >  body text

html5 - How should the Access-Control-Allow-Origin of the CORS mechanism be set?

Using cors across domains requires the target server to add your host in Access-Control-Allow-Origin or set Access-Control-Allow-Origin to *. If the target server is a third party, it seems unrealistic for him to add me. If it is a public API, it cannot be added. In this case, is it set to *? If set to * to accept requests from any domain name, will there be any problem with XSS attacks?

高洛峰高洛峰2669 days ago924

reply all(3)I'll reply

  • 为情所困

    为情所困2017-06-29 10:12:17

    Public APIs such as Baidu API require a secret key to adjust the interface. To adjust the interface of a third-party server, you need to apply for whitelisting. . .

    reply
    0
  • 世界只因有你

    世界只因有你2017-06-29 10:12:17

    For security considerations, most open interfaces require signature verification. You can take a look at Alibaba’s open interface https://market.aliyun.com/data

    reply
    0
  • 滿天的星座

    滿天的星座2017-06-29 10:12:17

    Pay attention, good question

    reply
    0
  • Cancelreply