You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add PROXY_UI_URL for separate UI/package URL advertisement (#161)
Adds UIBaseURL (env PROXY_UI_URL), advertised separately from BaseURL
for deployments where the UI is reached on a public domain while build
machines hit a Docker network alias for the package endpoints. Defaults
to BaseURL when unset.
Consumers:
- Logged alongside base_url at startup.
- <link rel="canonical"> and og:url / og:title / og:site_name in every
UI page, omitted when UIBaseURL is empty.
- Banner on the install guide when UIBaseURL differs from BaseURL,
clarifying that the URLs in the snippets are the package endpoint and
that the UI itself lives elsewhere.
Docs call out that the proxy serves UI and package endpoints on the same
listener, so reverse proxies fronting the UI publicly must restrict the
public route to PathPrefix(/ui) to avoid exposing /npm, /pypi, etc.
nginx and Traefik examples both show the path-split pattern.
@@ -934,49 +935,47 @@ When running behind nginx, Apache, or another reverse proxy, set `base_url` to y
934
935
base_url: "https://proxy.example.com"
935
936
```
936
937
937
-
nginx example:
938
+
If the UI is reached on a different hostname than the package endpoints — for example, the UI exposed publicly on a domain while build machines hit a Docker network alias — set `ui_base_url` separately. `base_url` is the URL package managers and metadata rewriting use; `ui_base_url` is the URL advertised to humans visiting the web UI (canonical/`og:url` tags and the install guide banner):
938
939
939
-
```nginx
940
-
server {
941
-
listen 443 ssl;
942
-
server_name proxy.example.com;
943
-
944
-
location / {
945
-
proxy_pass http://127.0.0.1:8080;
946
-
proxy_set_header Host $host;
947
-
proxy_set_header X-Real-IP $remote_addr;
948
-
proxy_buffering off;
949
-
}
950
-
}
940
+
```yaml
941
+
base_url: "http://pkg-proxy:8080" # internal alias for build machines
942
+
ui_base_url: "https://proxy.example.com/ui" # public UI URL
951
943
```
952
944
953
-
The UI is mounted under `/ui` so you can apply different access rules to it than to the package endpoints — for example, require auth for humans browsing the UI while leaving `/npm`, `/pypi`, and other package endpoints open to unauthenticated build machines:
945
+
When unset, `ui_base_url` defaults to `base_url`.
946
+
947
+
> **Warning:** the proxy serves the UI and package endpoints on the same listener. Setting `ui_base_url` only changes what URL the UI advertises to humans; it does not stop package endpoints from being reachable on the same hostname and port. When fronting the proxy with a public reverse proxy, restrict the public route to `PathPrefix(/ui)` (or your proxy's equivalent), otherwise `/npm`, `/pypi`, and the other package endpoints stay exposed alongside the UI.
948
+
949
+
nginx example, restricting the public host to the UI while leaving package endpoints reachable only on the internal listener:
954
950
955
951
```nginx
956
952
server {
957
953
listen 443 ssl;
958
954
server_name proxy.example.com;
959
955
960
-
# Web UI — require auth
961
956
location /ui/ {
962
-
auth_basic "git-pkgs proxy";
963
-
auth_basic_user_file /etc/nginx/.htpasswd;
964
957
proxy_pass http://127.0.0.1:8080;
965
958
proxy_set_header Host $host;
966
959
proxy_set_header X-Real-IP $remote_addr;
967
960
proxy_buffering off;
968
961
}
969
962
970
-
# Package endpoints — open to build machines
971
963
location / {
972
-
proxy_pass http://127.0.0.1:8080;
973
-
proxy_set_header Host $host;
974
-
proxy_set_header X-Real-IP $remote_addr;
975
-
proxy_buffering off;
964
+
return 404;
976
965
}
977
966
}
978
967
```
979
968
969
+
Traefik example using `PathPrefix(/ui)` so the public router only matches UI traffic:
|`listen`|`PROXY_LISTEN`|`-listen`|`:8080`| Address to listen on |
20
-
|`base_url`|`PROXY_BASE_URL`|`-base-url`|`http://localhost:8080`| Public URL for the proxy |
20
+
|`base_url`|`PROXY_BASE_URL`|`-base-url`|`http://localhost:8080`| Public URL package managers use to reach this proxy |
21
+
|`ui_base_url`|`PROXY_UI_URL`| - | (defaults to `base_url`) | Public URL where the web UI is reached. Set separately when the UI lives behind a different hostname than package endpoints (e.g. public domain vs Docker network alias). Used for canonical/og:url tags and the install guide banner. The proxy still serves package endpoints on the same listener, so any reverse proxy fronting the UI publicly should restrict the public route to `PathPrefix(/ui)` to avoid exposing package endpoints. |
0 commit comments