Skip to content

Commit 7a5e55a

Browse files
committed
docs: update CORS section
1 parent 06147a8 commit 7a5e55a

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Checkout all options in [Available options](#available-options) section.
6767
- This means you are using a UI with HTTPS and your registry is using HTTP (unsecured). When you are on a HTTPS site, you can't get HTTP content. Upgrade you registry with a HTTPS connection.
6868
- Why the default nginx `Host` is set to `$http_host` ?
6969
- This fixes the issue [#88](https://github.com/Joxit/docker-registry-ui/issues/88). More about this in [#113](https://github.com/Joxit/docker-registry-ui/issues/113).
70-
- Why OPTIONS (aka preflight requests) and DELETE fails with 401 status code (using Basic Auth) ?
70+
- Why OPTIONS (aka preflight requests) and DELETE fails with 401 status code (using Basic Auth) or why the UI says to check my `Access-Control-Allow-Origin` ?
7171
- This is caused by a bug in docker registry, it returns 401 status requests on preflight requests, this breaks [W3C preflight-request specification](https://www.w3.org/TR/cors/#preflight-request). I contacted docker registry maintainers and this will never be fixed ([distribution/distribution#4458](https://github.com/distribution/distribution/issues/4458)). I suggest to have your UI on the same domain than your registry e.g. registry.example.com/ui/ **or** use `NGINX_PROXY_PASS_URL` **or** configure a nginx/apache/haproxy in front of your registry that returns 200 on each OPTIONS requests. (see [#104](https://github.com/Joxit/docker-registry-ui/issues/104), [#204](https://github.com/Joxit/docker-registry-ui/issues/204), [#207](https://github.com/Joxit/docker-registry-ui/issues/207), [#214](https://github.com/Joxit/docker-registry-ui/issues/214), [#266](https://github.com/Joxit/docker-registry-ui/issues/266), [#278](https://github.com/Joxit/docker-registry-ui/issues/278)).
7272
- Can I use the docker registry ui as a standalone application (with Electron) ?
7373
- Yes, check out the example [here](https://github.com/Joxit/docker-registry-ui/tree/main/examples/electron). (see [#129](https://github.com/Joxit/docker-registry-ui/pull/129))
@@ -184,11 +184,19 @@ services:
184184
185185
## Using CORS
186186
187-
Your server should be configured to accept CORS.
187+
:warning: Before posting issues about CORS, please read the and all created issues.
188188
189-
If your docker registry does not need credentials, you will need to send this HEADER:
189+
:warning: If you **are using credentials** and your registry is on a different host than your UI, please read the [FAQ about OPTIONS](https://github.com/Joxit/docker-registry-ui#:~:text=Why%20OPTIONS%20(aka%20preflight%20requests)), all the linked issues and [distribution/distribution#4458](https://github.com/distribution/distribution/issues/4458) first. The best way for the UI to work is using `NGINX_PROXY_PASS_URL` or configure your own proxy (nginx, haproxy...) that will be on top of your **docker registry** (and not the UI!) to override OPTIONS requests.
190190

191+
If your docker registry **does not need credentials**, you will need to send this HEADER:
192+
193+
```yml
194+
http:
195+
headers:
191196
Access-Control-Allow-Origin: ['*']
197+
Access-Control-Allow-Headers: ['Accept', 'Cache-Control']
198+
Access-Control-Allow-Methods: ['HEAD', 'GET', 'OPTIONS'] # Optional
199+
```
192200

193201
If your docker registry need credentials, you will need to send these HEADERS (you must add the protocol `http`/`https` and the port when not default `80`/`443`):
194202

@@ -203,8 +211,6 @@ http:
203211

204212
An alternative for CORS issues is a plugin on your browser, more info [here](https://github.com/Joxit/docker-registry-ui/issues/25#issuecomment-621104846) (thank you [xmontero](https://github.com/xmontero)).
205213

206-
:warning: If you are using credential and still having issues, please read the the line about preflight requests and the bug in docker registry server in the [FAQ](#faq) before posting any issues.
207-
208214
## Using delete
209215

210216
For deleting images, you need to activate the delete feature in the UI with `DELETE_IMAGES=true` and in your registry:

0 commit comments

Comments
 (0)