@@ -61,18 +61,32 @@ async function handleRequest(request) {
6161 const isQuay = upstream == registry_quay ;
6262 const authorization = request . headers . get ( "Authorization" ) ;
6363
64- if ( url . pathname == "/v1/search" ) {
64+ if ( url . pathname . startsWith ( "/v1/" ) ) {
6565 let newUrl = url
6666
67- if ( isDockerHub ) {
68- newUrl = new URL ( index_dockerHub + "/v1/search" ) ;
69- } else if ( isQuay ) {
70- newUrl = new URL ( index_quay + "/v1/search" ) ;
71- } else {
72- newUrl = url
67+ // Docker API /v1/_ping
68+ // https://docs.docker.com/reference/api/engine/version/v1.47/#tag/System/operation/SystemPing
69+ if ( url . pathname == "/v1/_ping" ) {
70+ return new Response ( null , {
71+ status : 200 ,
72+ headers : {
73+ "content-type" : "text/plain" ,
74+ } ,
75+ } ) ;
7376 }
7477
75- newUrl . search = url . search ;
78+ // Docker API /v1/search
79+ if ( url . pathname == "/v1/search" ) {
80+ if ( isDockerHub ) {
81+ newUrl = new URL ( index_dockerHub + "/v1/search" ) ;
82+ } else if ( isQuay ) {
83+ newUrl = new URL ( index_quay + "/v1/search" ) ;
84+ } else {
85+ newUrl = url
86+ }
87+
88+ newUrl . search = url . search ;
89+ }
7690
7791 const headers = new Headers ( ) ;
7892 if ( authorization ) {
@@ -136,10 +150,12 @@ async function handleRequest(request) {
136150 }
137151 return await fetchToken ( wwwAuthenticate , scope , authorization ) ;
138152 }
153+ console . log ( JSON . stringify ( url , null , 2 ) )
139154 // redirect for DockerHub library images
140155 // Example: /v2/busybox/manifests/latest => /v2/library/busybox/manifests/latest
141156 if ( isDockerHub ) {
142157 const pathParts = url . pathname . split ( "/" ) ;
158+ console . log ( JSON . stringify ( url , null , 2 ) )
143159 if ( pathParts . length == 5 ) {
144160 pathParts . splice ( 2 , 0 , "library" ) ;
145161 const redirectUrl = new URL ( url ) ;
0 commit comments