一元网络论坛

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 129|回复: 0

Cloudflare Workers 反代,加速任意 HTTP 请求,含 GitHub 和 Docker。

[复制链接]

1万

主题

1万

帖子

5万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
57584
发表于 2024-7-29 04:19:51 | 显示全部楼层 |阅读模式
GitHub: GitHub - jonssonyan/cf-workers-proxy: Cloudflare Workers HTTP Reverse Proxy

This project can be used to proxy (and speed up) web pages, APIs, Docker/Kubernetes image repositories, and any other HTTP requests. Real-world testing confirms its effectiveness in accelerating access to GitHub pages and Docker image repositories.



The project was initiated due to the blocking of Docker image repositories, with no satisfactory alternatives available. The solution leverages Cloudflare Workers for implementing an HTTP reverse proxy, capable of handling all HTTP requests, but commonly used for proxying various image repositories.

A generic version has been developed for proxying specific domains, featuring:


  
  • Proxy address configuration
      
  • Choice of proxy protocol
      
  • Path matching for the proxy address
      
  • User-Agent whitelist
      
  • Customizable 302 redirection URL

    For instance, if you wish to proxy only GitHub release files, such as https://github.com/jonssonyan/h-ui/releases/download/v0.0.5/h-ui-linux-amd64 and https://github.com/jonssonyan/h-ui/archive/refs/tags/v0.0.5.zip:

    The environment variables could be set as follows:

    PROXY_HOSTNAME: github.com
    PATHNAME_REGEX: ^/jonssonyan/.+/(archive|releases)
    UA_REGEX: (curl)
    URL302: https://jonssonyan.com

    The end result is that it will proxy URLs from github.com specifically for user jonssonyan's repositories, targeting the archive and releases sections, accepting requests only from curl. Non-compliant requests are redirected to https://jonssonyan.com.

    Note:


      
  • If a proxy request fails, it may be due to a blocked IP assigned by CF; in this case, IP optimization is required.
      
  • With a Free account, there's a daily limit of 100,000 requests. If you're proxying web pages, monitor your usage carefully.
  • 回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    Archiver|手机版|小黑屋|一元网络论坛

    GMT+8, 2024-9-21 22:48 , Processed in 0.072334 second(s), 20 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表