taxy icon indicating copy to clipboard operation
taxy copied to clipboard

Webui entry can cause taxy to crash on startup

Open the-moog opened this issue 1 year ago • 0 comments

Running an a QNAP nas using the distro of myqnap.org

taxy 0.3.29 (consider adding a --version or version number in the help command) as that came from the following.

[admin@NASxxxxxx Taxy]# ./taxy start --log=/dev/stderr --config-dir .config/taxy/
thread 'main' panicked at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/taxy-0.3.29/src/proxy/http/route.rs:29:45:
called `Result::unwrap()` on an `Err` value: InvalidServerUrl { url: Url { scheme: "localhost", cannot_be_a_base: true, username: "", password: None, host: None, port: None, path: "49492", query: None, fragment: None } }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Hmm, it looks like some sanitisation of dialog input is required.

The offending config entry is in proxies.toml I had not put an explicit protocol prefix in the dialog entry field. Which it saved and then when it was reset it broke it.

[zgt-dpr]
name = "Taxi (internal only)"
ports = ["xrh-zxv"]
protocol = "http"
vhosts = ["taxy.abc.xyz", "certs.abc.xyz"]
routes = [{ path = "/", servers = [{ url = "localhost:46492" }] }]

Clearly it does not like the url="localhost:46492" without the accompanying protocol prefix of http://
Maybe this is even a library issue? (I've not done enough Rust to know) As far as I can recall most if not all URL parsers I've used (i.e. python and C++) would not have an issue with that, especially as there is both a subtle hint in protocol=http and the fact that unless you do some DNS magic, all browsers try both upgrading http to https and downgrading to http that fails. They always start with http as that is need to read the certificate. You should need to be explicit. But in this case, as getting it wrong kills it completely, some sanitisation is needed. Luckily I am familiar enough with the guts of the QNAP NAS to fix the config file in the cli. It did have be confused for a short while though as it lacks any logging at all that I could find under the QNAP UI. But there is a logging database, but it's binary so I assume what QNAP captures rather than some patch to Taxy. For for some reason does not publish it - app exit codes a the shell level perhaps? Never tried writing add an-add for QNAP so unsure what the mechanisms are. I've no idea who made the port so not sure what to suggest there.

the-moog avatar Aug 11 '24 08:08 the-moog