fakeheal/cors-anywhere
Composer 安装命令:
composer require fakeheal/cors-anywhere
包简介
cors-anywhere is a php reverse proxy which adds CORS headers to the proxy request.
README 文档
README
cors-anywhere is a php reverse proxy which adds CORS headers to the proxy request.
Use Case
It can be used to access resources from third party websites when it's not possible to enable CORS on target website i.e. when you don't own that website.
Note from author: I am currently using to access Rescue Time's & trak.tv APIs, so I can sync my own data to conjure.so.
Documentation
Install
composer require fakeheal/cors-anywhere
Initialize
<?php use Fakeheal\CorsAnywhere\Exceptions\CorsAnywhereException; use Fakeheal\CorsAnywhere\Proxy; // ... try { $server = new Proxy([ // allowed hosts to proxy to 'rescuetime.com', 'google.com' ], [ // allowed headers 'Content-Type', 'Accepts' ]); // call handle that... handles everything $server->handle(); } catch (CorsAnywhereException $e) { die($e->getMessage()); // or die trying }
How to use
Once setup, you must pass a url parameter, for example if your Cors URL is the following: http://127.0.0.1:2000
Then you'd do the below, the url being the proxied site you want to use.
http://127.0.0.1:2000/?url=https://google.com
Acknowledgements
Running Tests
To run tests, run the following command
./vendor/bin/pest
Used By
This project is used by the following entities:
License
fakeheal/cors-anywhere 适用场景与选型建议
fakeheal/cors-anywhere 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 35 次下载、GitHub Stars 达 7, 最近一次更新时间为 2023 年 06 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 fakeheal/cors-anywhere 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 fakeheal/cors-anywhere 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 35
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-06-14