Skip to content

Commit

Permalink
Merge branch 'ciiiii:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
chmdir authored Feb 22, 2025
2 parents f63467d + dfac79d commit e5d1601
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 26 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/stage.yaml

This file was deleted.

12 changes: 11 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,22 @@ async function handleRequest(request) {
const newReq = new Request(newUrl, {
method: request.method,
headers: request.headers,
redirect: "follow",
// don't follow redirect to dockerhub blob upstream
redirect: isDockerHub ? "manual" : "follow",
});
const resp = await fetch(newReq);
if (resp.status == 401) {
return responseUnauthorized(url);
}
// handle dockerhub blob redirect manually
if (isDockerHub && resp.status == 307) {
const location = new URL(resp.headers.get("Location"));
const redirectResp = await fetch(location.toString(), {
method: "GET",
redirect: "follow",
});
return redirectResp;
}
return resp;
}

Expand Down
1 change: 1 addition & 0 deletions wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ CUSTOM_DOMAIN = "libcuda.so"
[env.dev.vars]
MODE = "debug"
TARGET_UPSTREAM = "https://registry-1.docker.io"
CUSTOM_DOMAIN = "exmaple.com"

[env.production]
name = "cloudflare-docker-proxy"
Expand Down

0 comments on commit e5d1601

Please sign in to comment.