{"id":13626365,"url":"https://github.com/lisonge/serverless-http-forward","last_synced_at":"2025-04-15T06:41:10.078Z","repository":{"id":161598665,"uuid":"341176768","full_name":"lisonge/serverless-http-forward","owner":"lisonge","description":"阿里云 函数计算 HTTP 转发","archived":false,"fork":false,"pushed_at":"2022-06-06T03:59:13.000Z","size":78,"stargazers_count":13,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T17:11:15.771Z","etag":null,"topics":["aliyun","forward","http","serverless"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lisonge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-22T11:25:55.000Z","updated_at":"2024-09-15T23:53:57.000Z","dependencies_parsed_at":"2023-05-22T05:15:10.551Z","dependency_job_id":null,"html_url":"https://github.com/lisonge/serverless-http-forward","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lisonge%2Fserverless-http-forward","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lisonge%2Fserverless-http-forward/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lisonge%2Fserverless-http-forward/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lisonge%2Fserverless-http-forward/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lisonge","download_url":"https://codeload.github.com/lisonge/serverless-http-forward/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249023723,"owners_count":21199958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aliyun","forward","http","serverless"],"created_at":"2024-08-01T21:02:16.380Z","updated_at":"2025-04-15T06:41:10.056Z","avatar_url":"https://github.com/lisonge.png","language":"TypeScript","readme":"\u003c!--\n * @Date: 2021-02-22 19:36:04\n * @LastEditors: lisonge\n * @Author: lisonge\n * @LastEditTime: 2021-08-19 15:51:30\n--\u003e\n\n# serverless-http-forward\n\n阿里云 函数计算 HTTP 转发\n\n## 说明\n\n- 转发 HTTP 请求\n\n- 链式调用的拦截器，允许跨域，路由权限控制等\n\n### 不会转发的 HTTP Request Header 字段\n\n- host\n\n### 不会转发的 HTTP Response Header 字段\n\n- connection\n- content-encoding\n- content-length\n- date\n- keep-alive\n- transfer-encoding\n\n### 使用\n\n```shell\ngit clone --depth=1 https://github.com/lisonge/serverless-http-forward.git\ncd serverless-http-forward\npnpm i\npnpm run build\n```\n\n更改 [config.toml](./config.toml) 中的 `forward_url` 为要转发的 HTTP URL\n\n然后把除了 .git 和 node_modules 的所有文件压缩成一个 any_name.zip\n\n然后在 函数计算 香港地区 新建一个 node14 HTTP函数，配置函数入口 index.aliyunHandler\n\n上传刚刚的压缩包即可部署，后续可以绑定自定义域名\n\n## 用途\n\n当 访问 \u003chttps://i.songe.li\u003e 时\n\n会调用 阿里云的 HTTP 函数(香港地区) 转发 此 HTTP 请求\n\n到 (上海地区)服务器的 \u003chttp://47.103.215.184:8888\u003e，然后转发回复\n\n以 较低廉/零 的价格实现 无备案域名解析到 内地服务器\n\n或者部署在 香港地区 转发海外api, 算是一种轻量级的翻墙方式\n\n## 延迟\n\n测试访问延迟\n\n```shell\n❯ curl -o /dev/null -s -w %{time_namelookup}:%{time_connect}:%{time_starttransfer}:%{time_total} 'http://47.103.215.184:8888'\n0.000018:0.052224:0.252735:0.252797%\n❯ curl -o /dev/null -s -w %{time_namelookup}:%{time_connect}:%{time_starttransfer}:%{time_total} 'https://i.songe.li'\n0.115642:0.159558:0.509337:0.509372%\n```\n\n在只作为 API 接口的情况下 延迟在可接受范围内\n\n## 注意\n\n- HTTP header 里 Set-Cookie 在单纯转发下将会出现问题\n\n- 是 HTTP 转发，不是 TCP 代理，所以不支持 Websocket\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flisonge%2Fserverless-http-forward","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flisonge%2Fserverless-http-forward","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flisonge%2Fserverless-http-forward/lists"}