ztnet icon indicating copy to clipboard operation
ztnet copied to clipboard

[Support]: Subpath on IP/Hostname

Open Slyke opened this issue 7 months ago • 5 comments

📝 Inquiry

Is it possible to set a subpath for the WUI?

So instead of 192.168.1.5:3000, I can instead use 192.168.1.5:3000/zt-wui, and all requests will use this subpath?

I don't see this option in the environment variables. This would allow for this application to run behind a reverse proxy.

https://ztnet.network/installation/options

🔖 Version

0.7.4

🔧 Deployment Type

  • [x] Docker
  • [ ] Standalone

💻 Operating System

Other Linux

🌐 Browser

Chrome

📚 Any Other Information That May Be Helpful

No response

Slyke avatar May 25 '25 07:05 Slyke

Next.js (which ZTNet uses) supports a basePath property in next.config.ts that allows the application to run on a subpath. However, this configuration is set at build time, meaning you would need to rebuild the application with your specific subpath.

Adding dynamic subpath support at runtime is not a trivial task. https://nextjs.org/docs/app/api-reference/config/next-config-js/basePath

sinamics avatar May 25 '25 07:05 sinamics

Ohh, that's too bad. Basically means you can't use it behind a reverse proxy, unless you dedicate a subdomain or different port for it.

Slyke avatar May 25 '25 08:05 Slyke

you can do something like this:

location /ztnet/ {
    proxy_pass http://localhost:3000/;
}

sinamics avatar May 25 '25 08:05 sinamics

That causes a whole bunch of 404s, as it still tries to use the top level directory.

Image

Slyke avatar May 25 '25 08:05 Slyke

yeah, ztnet will still try to use / i will look into this and see if we could add a runtime variable for subpath when i get time.

sinamics avatar May 25 '25 08:05 sinamics