docker-registry-ui icon indicating copy to clipboard operation
docker-registry-ui copied to clipboard

Add option for a path prefix (context path)

Open MartinHerren opened this issue 5 years ago • 3 comments

It would be great to be able to add a path prefix to run your registry-ui on a non-root path, like http://domain/registry

I currently run it behind a traefik reverse proxy which strips the /registry from the path, and it works if i use http://domain/registry/ (with trailing slash) but fails with http://domain/registry (without trailing slash) as the browser will try to locate the .css and .js from the root path instead on the /registry/ path.

Having an option to set a path prefix would make it much easier to run it behind a proxy.

MartinHerren avatar Sep 19 '19 09:09 MartinHerren

Hi,

A quick fix for your issue is to force the use of the trailing slash (with a 301 redirect for example). I also use the project behind a reverse proxy (nginx) and when I go to https://example.com/ui, there is a redirect to https://example.com/ui/, Nginx did it alone.

Joxit avatar Sep 19 '19 20:09 Joxit

I also want the feature of being able to set the path. Haven't checked yet if I can do it via kubernetes' nginx ingress controller, but having support directly from this software would be better. Via an environment variable if possible (kubernetes' way...)

cr1st1p avatar Jan 19 '20 17:01 cr1st1p

For nginx, the correct configuration is :

  location /registry/ {
    proxy_pass http://docker-registry-ui/;
  }

I used relative path to bypass these kinds of issues.

Joxit avatar Jan 24 '20 14:01 Joxit

This is what helped me in my case

location  /foo/ {
  rewrite /foo/(.*) /$1  break;
  proxy_pass         http://registry-ui;
  proxy_redirect     off;
  proxy_set_header   Host $host;
}

M0n7y5 avatar Nov 10 '23 12:11 M0n7y5

Thanks @M0n7y5 , this is a common proxy configuration, I will close this issue

Joxit avatar Nov 24 '23 17:11 Joxit