Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable optionally serving applications under subpath/path prefix #42

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ to the `docker run` command.
|`VNC_PASSWORD`| Password needed to connect to the application's GUI. See the [VNC Password](#vnc-password) section for more details. | (unset) |
|`X11VNC_EXTRA_OPTS`| Extra options to pass to the x11vnc server running in the Docker container. **WARNING**: For advanced users. Do not use unless you know what you are doing. | (unset) |
|`ENABLE_CJK_FONT`| When set to `1`, open-source computer font `WenQuanYi Zen Hei` is installed. This font contains a large range of Chinese/Japanese/Korean characters. | `0` |
|`PATH_PREFIX`| Sets the path prefix under which the application can be served. Example: `PATH_PREFIX=/path/to/app` enables accessing the app via `example.com/path/to/app/` | (unset) |


## Config Directory
Inside the container, the application's configuration should be stored in the
Expand Down
5 changes: 5 additions & 0 deletions rootfs/defaults/default_site.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ server {

root /opt/novnc;
index index.html;

# Support serving application under path prefix.
location /sed_path_prefix {
rewrite ^/sed_path_prefix(.*)$ $1 last;
}

location /websockify {
proxy_pass http://127.0.0.1:5950;
Expand Down
5 changes: 5 additions & 0 deletions rootfs/etc/cont-init.d/10-nginx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ if ! ifconfig -a | grep -wq inet6; then
sed-patch '/^[\t]listen \[::\]:5800 /d' /etc/nginx/default_site.conf
fi

# If environment Variable PATH_PREFIX is defined, replace it in virtual server configuration.
if [[ ! -z "${PATH_PREFIX:-}" ]]; then
sed-patch "s|/sed_path_prefix|$PATH_PREFIX|g" /etc/nginx/default_site.conf
fi

# Make sure required directories exist.
s6-setuidgid $USER_ID:$GROUP_ID mkdir -p /config/log/nginx

Expand Down