|
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.
|
|