docker-baseimage-gui icon indicating copy to clipboard operation
docker-baseimage-gui copied to clipboard

[Feature Request] Web path prefix support

Open sgpublic opened this issue 1 year ago • 6 comments

As the title says, if web prefixes are supported, multiple instances can be deployed on a single domain name without conflicts.

There is already a PR: #42, but it is too old to be merged into the current repository.

Is there any plan to support this feature or accept PR? Thank you!

sgpublic avatar Aug 06 '24 13:08 sgpublic

Could you provide more details about the use case ? If you are running multiple instances, I guess they each run on different ports ? So you need to run them behind a reverse proxy or something like that ?

jlesage avatar Aug 06 '24 14:08 jlesage

Yes, I need to run noVNC behind a reverse proxy.

Specifically, I built my own image using docker-baseimage-gui, and then used noVNC and Web authentication (WEB_AUTHENTICATION ). Since I need to deploy multiple instances at the same time and also need public HTTPS access, I hope to access different instances through paths with different prefixes of a single domain name.

For example:

  • https://example.org/container/instance1 proxy_pass to instance1:5800
  • https://example.org/container/instance2 proxy_pass to instance2:5801

Currently, if I enable WEB_AUTHENTICATION, it will be forced to jump to /login/ when accessing. I have tried the following configuration:

    location ~ /container/instance1 {
        include /etc/nginx/common.d/listen_location.conf;
        rewrite ^/container/instance1$ / break;
        rewrite ^/container/instance1(.*)$ $1 break;
        proxy_redirect https://$server_name/ /container/instance1/;
        proxy_pass https://$NAS_IP:5800;
    }

But the login interface on the web page uses /login/login: /rootfs/opt/noVNC/login/index.html#L35, external configuration alone can no longer meet this requirement.

sgpublic avatar Aug 06 '24 14:08 sgpublic

Ok, so yes, the way to go is to use the reverse proxy to server the interface of a container under a different path. You can check one of my container's documentation for an example of proxy configuration (e.g. https://github.com/jlesage/docker-crashplan-pro?tab=readme-ov-file#routing-based-on-url-path).

The bug/problem, as you mentioned, is the login page that uses absolute path. This can be fixed.

Is it working well without WEB_AUTHENTICATION enabled ?

jlesage avatar Aug 06 '24 14:08 jlesage

Is it working well without WEB_AUTHENTICATION enabled ?

Yes, it works well after I modified the configuration:

    location = /container/instance1 {
        return 302 https://$server_name/container/instance1/;
    }
    location ~ /container/instance1/ {
        include /etc/nginx/common.d/listen_location.conf;
        rewrite ^/container/instance1(.*)$ $1 break;
        proxy_redirect https://$server_name/ /container/instance1/;
        proxy_pass https://$NAS_IP:5800;
    }

The bug/problem, as you mentioned, is the login page that uses absolute path. This can be fixed.

I modified /rootfs/opt/noVNC/login/index.htm locally:

                     <div id="loginStatus" class="alert alert-danger mb-4 d-none" role="alert">
                     </div>
-                    <form action="/login/login" method="post" id="loginForm" novalidate>
+                    <form action="login" method="post" id="loginForm" novalidate>
                     <div class="form-floating mb-3">

Now it works fine when WEB_AUTHENTICATION is enabled.

sgpublic avatar Aug 06 '24 15:08 sgpublic

I found few other things that doesn't work well (fonts, logout, etc). I'm working on fixing these.

jlesage avatar Aug 07 '24 18:08 jlesage

I found few other things that doesn't work well (fonts, logout, etc). I'm working on fixing these.

Hey, just checking in—any idea when we might get the next release? 😊

sgpublic avatar Aug 23 '24 02:08 sgpublic

Fixed in version 4.6.4.

jlesage avatar Aug 31 '24 13:08 jlesage