mirror of
https://github.com/ciiiii/cloudflare-docker-proxy.git
synced 2026-04-25 22:39:51 +08:00
Compare commits
7 Commits
yscai/fix-
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| f1f3168532 | |||
| a515cc4223 | |||
| d4b63ea38f | |||
| 730eb2e021 | |||
|
|
5f0b9200de | ||
|
|
c7ca5c64f9 | ||
|
|
c595a14166 |
1
.yarnrc.yml
Normal file
1
.yarnrc.yml
Normal file
@@ -0,0 +1 @@
|
|||||||
|
nodeLinker: node-modules
|
||||||
@@ -1,5 +1,14 @@
|
|||||||
# cloudflare-docker-proxy
|
# cloudflare-docker-proxy
|
||||||
|
|
||||||
|
> ### ⚠️ **Important Notice**
|
||||||
|
> <span style="color:#d73a49;font-weight:bold">Docker Hub is rate-limiting Cloudflare Worker IPs, causing frequent <code>429</code> errors.</span>
|
||||||
|
> <span style="color:#d73a49;font-weight:bold">This project is currently NOT recommended for production use.</span>
|
||||||
|
|
||||||
|
|
||||||
|
Due to the current instability, this project is not recommended for production use.
|
||||||
|
We will provide updates as soon as more information becomes available.
|
||||||
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
[](https://deploy.workers.cloudflare.com/?url=https://github.com/ciiiii/cloudflare-docker-proxy)
|
[](https://deploy.workers.cloudflare.com/?url=https://github.com/ciiiii/cloudflare-docker-proxy)
|
||||||
|
|||||||
3023
package-lock.json
generated
Normal file
3023
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -4,18 +4,18 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"author": "ciiiii <allen.cccccnm@gmail.com>",
|
"author": "ciiiii <allen.cccccnm@gmail.com>",
|
||||||
"dependencies": {},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"prettier": "^2.4.1",
|
"prettier": "^2.4.1",
|
||||||
"webpack": "^5.65.0",
|
"webpack": "^5.65.0",
|
||||||
"webpack-cli": "^4.9.1",
|
"webpack-cli": "^4.9.1",
|
||||||
"wrangler": "^3.36.0"
|
"wrangler": "^4.82.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"format": "prettier --write '**/*.{js,css,json,md}'",
|
"format": "prettier --write '**/*.{js,css,json,md}'",
|
||||||
"build": "webpack",
|
"build": "webpack",
|
||||||
"dev": "wrangler dev src/index.js --env dev"
|
"dev": "npx wrangler dev src/index.js --env dev"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "src/index.js"
|
"main": "src/index.js",
|
||||||
|
"packageManager": "yarn@4.3.0+sha512.1606bef7c84bc7d83b8576063de2fd08f7d69f9939015bed800f9585a002390268ecc777e9feeba7e26e9556aef6beaad4806968db2182ab5dd3e955ab3b9a0b"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ function routeByHosts(host) {
|
|||||||
|
|
||||||
async function handleRequest(request) {
|
async function handleRequest(request) {
|
||||||
const url = new URL(request.url);
|
const url = new URL(request.url);
|
||||||
|
if (url.pathname == "/") {
|
||||||
|
return Response.redirect(url.protocol + "//" + url.host + "/v2/", 301);
|
||||||
|
}
|
||||||
const upstream = routeByHosts(url.hostname);
|
const upstream = routeByHosts(url.hostname);
|
||||||
if (upstream === "") {
|
if (upstream === "") {
|
||||||
return new Response(
|
return new Response(
|
||||||
@@ -154,7 +157,7 @@ async function fetchToken(wwwAuthenticate, scope, authorization) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function responseUnauthorized(url) {
|
function responseUnauthorized(url) {
|
||||||
const headers = new(Headers);
|
const headers = new Headers();
|
||||||
if (MODE == "debug") {
|
if (MODE == "debug") {
|
||||||
headers.set(
|
headers.set(
|
||||||
"Www-Authenticate",
|
"Www-Authenticate",
|
||||||
|
|||||||
@@ -1,18 +1,20 @@
|
|||||||
name = "cloudflare-docker-proxy"
|
name = "cloudflare-docker-proxy"
|
||||||
compatibility_date = "2023-12-01"
|
compatibility_date = "2023-12-01"
|
||||||
|
main = "src/index.js"
|
||||||
|
|
||||||
|
[vars]
|
||||||
|
MODE = "production"
|
||||||
|
TARGET_UPSTREAM = ""
|
||||||
|
CUSTOM_DOMAIN = "example.com"
|
||||||
|
|
||||||
[dev]
|
[dev]
|
||||||
ip = "0.0.0.0"
|
ip = "0.0.0.0"
|
||||||
port = 8787
|
port = 8787
|
||||||
local_protocol = "http"
|
local_protocol = "http"
|
||||||
|
|
||||||
[env.vars]
|
|
||||||
CUSTOM_DOMAIN = "libcuda.so"
|
|
||||||
|
|
||||||
[env.dev.vars]
|
[env.dev.vars]
|
||||||
MODE = "debug"
|
MODE = "debug"
|
||||||
TARGET_UPSTREAM = "https://registry-1.docker.io"
|
TARGET_UPSTREAM = "https://registry-1.docker.io"
|
||||||
CUSTOM_DOMAIN = "exmaple.com"
|
|
||||||
|
|
||||||
[env.production]
|
[env.production]
|
||||||
name = "cloudflare-docker-proxy"
|
name = "cloudflare-docker-proxy"
|
||||||
@@ -29,6 +31,7 @@ name = "cloudflare-docker-proxy"
|
|||||||
[env.production.vars]
|
[env.production.vars]
|
||||||
MODE = "production"
|
MODE = "production"
|
||||||
TARGET_UPSTREAM = ""
|
TARGET_UPSTREAM = ""
|
||||||
|
CUSTOM_DOMAIN = "example.com"
|
||||||
|
|
||||||
[env.staging]
|
[env.staging]
|
||||||
name = "cloudflare-docker-proxy-staging"
|
name = "cloudflare-docker-proxy-staging"
|
||||||
@@ -37,3 +40,4 @@ name = "cloudflare-docker-proxy-staging"
|
|||||||
[env.staging.vars]
|
[env.staging.vars]
|
||||||
MODE = "staging"
|
MODE = "staging"
|
||||||
TARGET_UPSTREAM = ""
|
TARGET_UPSTREAM = ""
|
||||||
|
CUSTOM_DOMAIN = "example.com"
|
||||||
|
|||||||
Reference in New Issue
Block a user