- Building RESTful Web services with Go
- Naren Yellavula
- 156字
- 2021-07-02 20:14:02
Cross-Origin Resource Sharing (CORS)
The most important application of this OPTIONS method is Cross-Origin Resource Sharing (CORS). Initially, browser security prevented the client from making cross-origin requests. It means a site loaded with the URL www.foo.com can only make API calls to that host. If the client code needs to request files or data from www.bar.com, then the second server, bar.com, should have a mechanism to recognize foo.com to get its resources.
This process explains the CORS:
- foo.com requests the OPTIONS method on bar.com.
- bar.com sends a header like Access-Control-Allow-Origin: http://foo.com in response to the client.
- Next, foo.com can access the resources on bar.com without any restrictions that call any REST method.
If bar.com feels like supplying resources to any host after one initial request, it can set Access control to * (that is, any).
The following is the diagram depicting the process happening one after the other:
推薦閱讀
- 物聯網標準化指南
- 微商之道
- Cisco OSPF命令與配置手冊
- 物聯網檢驗檢測技術
- 信息通信網絡建設安全管理概要2
- Building RESTful Web Services with Spring 5(Second Edition)
- SSL VPN : Understanding, evaluating and planning secure, web/based remote access
- 物聯網長距離無線通信技術應用與開發
- SAE原理與網絡規劃
- Learning Storm
- Android UI Design
- 網絡利他行為研究:積極心理學的視角
- 人人都該都懂的互聯網思維
- Hands-On Microservices with Node.js
- 全聯網標識服務