-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Description
As stated in the CORS Protocol, in a preflight request, i.e. on an OPTIONS request, the server should return specific headers and 200 or 204 status code.
The headers can be configured with the configuration file, however, the server is always returning an HTTP/1.1 401 Unauthorized
status code.
from 3.2.3. HTTP responses:
A successful HTTP response, i.e., one where the server developer intends to share it, to a CORS request can use any status, as long as it includes the headers stated above with values matching up with the request.
A successful HTTP response to a CORS-preflight request is similar, except it is restricted to an ok status, e.g., 200 or 204.
Any other kind of HTTP response is not successful and will either end up not being shared or fail the CORS-preflight request. Be aware that any work the server performs might nonetheless leak through side channels, such as timing. If server developers wish to denote this explicitly, the 403 status can be used, coupled with omitting the relevant headers.
Reproduce
Using the configuration:
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/registry
http:
addr: :5000
auth:
htpasswd:
realm: basic-realm
path: /etc/docker/registry/htpasswd
- docker run -ti --rm -p 5000:5000 -v $(pwd)/config.yml:/etc/docker/registry/config.yml registry:2.8.3
curl -vv -X OPTIONS http://127.0.0.1:5000/v2/_catalog
Expected behavior
The server should return a 200 status code.
registry version
registry github.com/docker/distribution 2.8.3
Additional Info
No response