- 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:
推薦閱讀
- SOA用戶指南
- EDA技術與VHDL編程
- 互聯網安全的40個智慧洞見:2014年中國互聯網安全大會文集
- 物聯網與無線傳感器網絡
- 2小時讀懂物聯網
- Building Web Applications with ArcGIS
- Practical Web Penetration Testing
- Building RESTful Web Services with .NET Core
- Cisco無線局域網配置基礎
- 從物聯到萬聯:Node.js與樹莓派萬維物聯網構建實戰
- SEO攻略:搜索引擎優化策略與實戰案例詳解
- LiveCode Mobile Development Beginner's Guide
- 世界網力:2018年中國網信產業桔皮書
- Mastering Prezi for Business Presentations
- 移動應用開發技術