mirror of
https://github.com/Joxit/docker-registry-ui.git
synced 2025-04-30 17:09:55 +03:00
feat(nginx): add support for proxy_pass_header
directive via NGINX_PROXY_PASS_HEADER_*
fixes #206
This commit is contained in:
parent
f958365336
commit
3a385fc08d
3 changed files with 22 additions and 2 deletions
|
@ -47,6 +47,7 @@ This web user interface uses [Riot](https://github.com/Riot/riot) the react-like
|
||||||
- Set a list of default registries with `DEFAULT_REGISTRIES` (see [#219](https://github.com/Joxit/docker-registry-ui/pull/219)).
|
- Set a list of default registries with `DEFAULT_REGISTRIES` (see [#219](https://github.com/Joxit/docker-registry-ui/pull/219)).
|
||||||
- Desactivate add and remove regisitries with `READ_ONLY_REGISTRIES` (see [#219](https://github.com/Joxit/docker-registry-ui/pull/219)).
|
- Desactivate add and remove regisitries with `READ_ONLY_REGISTRIES` (see [#219](https://github.com/Joxit/docker-registry-ui/pull/219)).
|
||||||
- Filter images and tags with a search bar. You can select the search bar with the shortcut `CRTL` + `F` or `F3`. When the search bar is already focused, the shortcut will fallback to the default behavior (see [#213](https://github.com/Joxit/docker-registry-ui/issues/213)).
|
- Filter images and tags with a search bar. You can select the search bar with the shortcut `CRTL` + `F` or `F3`. When the search bar is already focused, the shortcut will fallback to the default behavior (see [#213](https://github.com/Joxit/docker-registry-ui/issues/213)).
|
||||||
|
- **Forward** custom header to your backend registry via environment variable and file via `NGINX_PROXY_PASS_HEADER_*` (see [#206](https://github.com/Joxit/docker-registry-ui/pull/206)).
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
|
@ -90,7 +91,8 @@ Some env options are available for use this interface for **only one server**.
|
||||||
- `CATALOG_ELEMENTS_LIMIT`: Limit the number of elements in the catalog page. (default: `100000`).
|
- `CATALOG_ELEMENTS_LIMIT`: Limit the number of elements in the catalog page. (default: `100000`).
|
||||||
- `SINGLE_REGISTRY`: Remove the menu that show the dialogs to add, remove and change the endpoint of your docker registry. (default: `false`).
|
- `SINGLE_REGISTRY`: Remove the menu that show the dialogs to add, remove and change the endpoint of your docker registry. (default: `false`).
|
||||||
- `NGINX_PROXY_PASS_URL`: Update the default Nginx configuration and set the **proxy_pass** to your backend docker registry (this avoid CORS configuration). This is usually the name of your registry container in the form `http://registry:5000`.
|
- `NGINX_PROXY_PASS_URL`: Update the default Nginx configuration and set the **proxy_pass** to your backend docker registry (this avoid CORS configuration). This is usually the name of your registry container in the form `http://registry:5000`.
|
||||||
- `NGINX_PROXY_HEADER_*`: Update the default Nginx configuration and set **custom headers** for your backend docker registry. Only when `NGINX_PROXY_PASS_URL` is used.
|
- `NGINX_PROXY_HEADER_*`: Update the default Nginx configuration and **set custom headers** for your backend docker registry. Only when `NGINX_PROXY_PASS_URL` is used.
|
||||||
|
- `NGINX_PROXY_HEADER_*`: Update the default Nginx configuration and **forward custom headers** to your backend docker registry. Only when `NGINX_PROXY_PASS_URL` is used.
|
||||||
- `DEFAULT_REGISTRIES`: List of comma separated registry URLs (e.g `http://registry.example.com,http://registry:5000`), available only when `SINGLE_REGISTRY=false`. (default: ` `).
|
- `DEFAULT_REGISTRIES`: List of comma separated registry URLs (e.g `http://registry.example.com,http://registry:5000`), available only when `SINGLE_REGISTRY=false`. (default: ` `).
|
||||||
- `READ_ONLY_REGISTRIES`: Desactivate dialog for remove and add new registries, available only when `SINGLE_REGISTRY=false`. (default: `false`).
|
- `READ_ONLY_REGISTRIES`: Desactivate dialog for remove and add new registries, available only when `SINGLE_REGISTRY=false`. (default: `false`).
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,25 @@ get_nginx_proxy_headers() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_nginx_proxy_pass_headers() {
|
||||||
|
(
|
||||||
|
env &&
|
||||||
|
if [ -f "/etc/nginx/.env" ]; then
|
||||||
|
cat /etc/nginx/.env
|
||||||
|
# Force new line
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
) | while read e; do
|
||||||
|
if [ -n "$(echo $e | grep -o '^NGINX_PROXY_PASS_HEADER_')" ]; then
|
||||||
|
key=$(echo ${e%%=*} | sed 's/^NGINX_PROXY_PASS_HEADER_//' | sed 's/_/-/g')
|
||||||
|
echo -n "proxy_pass_header \"${key}\"; "
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
if [ -n "${NGINX_PROXY_PASS_URL}" ] ; then
|
if [ -n "${NGINX_PROXY_PASS_URL}" ] ; then
|
||||||
sed -i "s,\${NGINX_PROXY_PASS_URL},${NGINX_PROXY_PASS_URL}," /etc/nginx/conf.d/default.conf
|
sed -i "s,\${NGINX_PROXY_PASS_URL},${NGINX_PROXY_PASS_URL}," /etc/nginx/conf.d/default.conf
|
||||||
sed -i "s^\${NGINX_PROXY_HEADERS}^$(get_nginx_proxy_headers)^" /etc/nginx/conf.d/default.conf
|
sed -i "s^\${NGINX_PROXY_HEADERS}^$(get_nginx_proxy_headers)^" /etc/nginx/conf.d/default.conf
|
||||||
|
sed -i "s^\${NGINX_PROXY_PASS_HEADERS}^$(get_nginx_proxy_pass_headers)^" /etc/nginx/conf.d/default.conf
|
||||||
sed -i "s,#!,," /etc/nginx/conf.d/default.conf
|
sed -i "s,#!,," /etc/nginx/conf.d/default.conf
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -27,6 +27,7 @@ server {
|
||||||
#! return 404;
|
#! return 404;
|
||||||
#! }
|
#! }
|
||||||
#! ${NGINX_PROXY_HEADERS}
|
#! ${NGINX_PROXY_HEADERS}
|
||||||
|
#! ${NGINX_PROXY_PASS_HEADERS}
|
||||||
#! proxy_pass ${NGINX_PROXY_PASS_URL};
|
#! proxy_pass ${NGINX_PROXY_PASS_URL};
|
||||||
#! }
|
#! }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue