From 988ff72081501f9f2ba40a3c7cac384a6e270faa Mon Sep 17 00:00:00 2001 From: Juan Picado Date: Sun, 22 Aug 2021 10:20:23 +0200 Subject: [PATCH] docs: improve url_prefix docs and public domain override --- website/docs/config.md | 2 +- website/docs/reverse-proxy.md | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/website/docs/config.md b/website/docs/config.md index 5f44a9c8b..eb3cbcfbd 100644 --- a/website/docs/config.md +++ b/website/docs/config.md @@ -155,7 +155,7 @@ The prefix is intended to be used when the server runs behinds the proxy, check url_prefix: /verdaccio/ ``` -> Verdaccio 5 has an improved prefix behaviour, [check here details](https://verdaccio.org/blog/2021/04/14/verdaccio-5-migration-guide#url_prefix-improved-behavior). +> Verdaccio 5 has an improved prefix behaviour and the `VERDACCIO_PUBLIC_URL` is avilable for use, learn how to [here](https://verdaccio.org/blog/2021/04/14/verdaccio-5-migration-guide#url_prefix-improved-behavior). ### Max Body Size {#max-body-size} diff --git a/website/docs/reverse-proxy.md b/website/docs/reverse-proxy.md index 6296735e0..6f7006809 100644 --- a/website/docs/reverse-proxy.md +++ b/website/docs/reverse-proxy.md @@ -194,3 +194,34 @@ location ~ ^/verdaccio/(.*)$ { For this case, `url_prefix` should set to `/verdaccio/` > Note: There is a slash after the install path (`https://your-domain:port/verdaccio/`)! + +### Overriding the public url + +> Since `verdaccio@5.0.0` + + +The new `VERDACCIO_PUBLIC_URL` is intended to be used behind proxies, this variable will be used for: + +- Used as base path to serve UI resources as (js, favicon, etc) +- Used on return metadata `dist` base path +- Ignores `host` and `X-Forwarded-Proto` headers +- If `url_prefix` is defined would be appened to the env variable. + +``` +VERDACCIO_PUBLIC_URL='https://somedomain.org'; +url_prefix: '/my_prefix' + +// url -> https://somedomain.org/my_prefix/ + +VERDACCIO_PUBLIC_URL='https://somedomain.org'; +url_prefix: '/' + +// url -> https://somedomain.org/ + +VERDACCIO_PUBLIC_URL='https://somedomain.org/first_prefix'; +url_prefix: '/second_prefix' + +// url -> https://somedomain.org/second_prefix/' +``` + +![Screenshot from 2021-03-24 20-20-11](https://user-images.githubusercontent.com/558752/112371003-5fa1ce00-8cde-11eb-888c-70c4e9776c57.png)