Docker hub proxy solution issue

I want to make a docker hub proxy
My solution is nginx and one java API service as nginx backend server

nginx listen 6699 port

when docker daemon pull docker hub official image using: docker pull 127.0.0.1:6699/library/hello-world:latest
nginx will send the request to java API service, java API service will send the request to docker hub

in this solution, the manifest can be handle success.
but get layer blobs fail

during get layer blobs, java API service can get the correct response from dockerhub
but the docker demain will popup the error: filesystem layer verification failed for digest

what’s wrong when get layer blobs?

I find the reason for the error: filesystem layer verification failed for digest
It is java API service problem.
after java API service get response from docker hub,
it get the response body as String first, and then convert the String to byte array, this is not correct.
it should get the response body as byte array directly, then there is no filesystem layer verification error