# cors-proxy **Repository Path**: clia/cors-proxy ## Basic Information - **Project Name**: cors-proxy - **Description**: 用于添加 CORS 标头的 HTTP 服务代理。 - **Primary Language**: Rust - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2023-03-03 - **Last Updated**: 2024-02-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # clia-cors-proxy A http service proxy to add CORS headers. ## Install 1. Install Rust: ```shell curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` 2. Install this: ```shell cargo install clia-cors-proxy ``` ## Usage clia-cors-proxy `` `` `` `` Examples: ```bash clia-cors-proxy localhost 19002 localhost 19001 clia-cors-proxy localhost 19003 example.com 80 ``` ## Changelog - Version 0.2.0: Direct respond for OPTIONS requests. - Version 0.1.1: Improve log output. - Version 0.1.0: Initial version. ## 原理说明 这个就是开一个代理服务,这个服务就是专门给代理的请求加一个CORS跨域的头。你要访问所需的接口,先访问这个服务,这个服务代理去访问那个接口,然后在返回的响应消息上加一个CORS跨域的头,这样浏览器就可以读取到返回的数据内容了。