TasmoAdmin "Not Found" after visiting Login Page

root@DietPi4b:~# cat /boot/dietpi/.version
root@DietPi4b:~# echo $G_DISTRO_NAME $G_RASPBIAN
bookworm 0
root@DietPi4b:~# uname -a
Linux DietPi4b 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux
root@DietPi4b:~# dpkg --print-architecture
root@DietPi4b:~# echo $G_HW_MODEL_NAME
RPi 4 Model B (aarch64)
  • Power supply used | (POE Adapter)
  • SD card used | (SSD)

Additional Information (if applicable)

  • Software title | (EG: TasmoAdmin)
  • Was the software title installed freshly or updated/migrated? Fresh installation
  • Can this issue be replicated on a fresh installation of DietPi? Yes
    ← If you sent a “dietpi-bugreport”, please paste the ID here → 5d5bdec4-2d25-4a8c-9820-8c9f464f7043

Steps to reproduce

  1. Fresh installation of TasmoAdmin via dietpi-software

Expected behaviour

Actual behaviour

  • Showing “Not Found” in Browser

Extra details

  • Webserver: Lighttpd

I tested with nginx and lighttpd and both showed 404, it redirects to /tasmoadmin/login which does not exist.
But according to this it worked back in May :thinking:

It looks like something has changed in the current Tasmoadmin version and the web server configuration with Nginx and Lighttpd no longer works, while Apache2 still works fine. Something we need to have a look into. Ping @MichaIng

Nasty that the release notes at least do not contain any hint about such change: Release v3.1.0 · TasmoAdmin/TasmoAdmin · GitHub

Also I so not see something in the actual changed files: Comparing v3.0.8...v3.1.0 · TasmoAdmin/TasmoAdmin · GitHub

The redirect is correct: https://github.com/TasmoAdmin/TasmoAdmin/blob/ccab9fdb949abd27aa5a644e287f0b085abdd918/tasmoadmin/index.php#L66-L69

The Lighttpd config contains this rewrite rule:

"^/tasmoadmin/login$" => "/tasmoadmin/login.php",

But it needs to be

"^/tasmoadmin/login$" => "/tasmoadmin/pages/login.php",

it seems: https://github.com/TasmoAdmin/TasmoAdmin/blob/ccab9fdb949abd27aa5a644e287f0b085abdd918/tasmoadmin/pages/login.php
This changed in v3.0.0 already, so unless there was some additional internal helper to redirect to the correct login page, this should have never worked since Bookworm on.

Fixed with: DietPi-Software | TasmoAdmin: Fix Nginx and Lighttpd config on Bookworm by MichaIng · Pull Request #6545 · MichaIng/DietPi · GitHub

While with Nginx it was trivial, it took me the whole evening to figure out how to fix it for Lighttpd:

  • /tasmoadmin/pages/login.php is the correct login script, but it cannot be called directly.
  • Since TasmoAdmin 3.0.0, all requests must be done via index.php, appending query strings and paths. Hence the redirect target needs to be /tasmoadmin/index.php/login. The same is true for all other rewrites. Positive aspect is that there is no complicated per-URL logic required anymore, but a single rule to rewrite all /tasmoadmin/foo to /tasmoadmin/index.php/foo is sufficient. The backend now has a front controller to internally handle request URLs correctly.
  • While this works with Apache and Nginx, Lighttpd has problems: Deep investigation revealed a general problem about how Lighttpd sets FastCGI parameters when doing rewrites to the backend. Particularly, it sets PHP_SELF to /tasmoadmin/index.php/login while it is intended to be the path to the script only, i.e. /tasmoadmin/index.php. With the path still appended to the URL, the backend now internally creates all URLs (hence all navigation links) prefixed with /tasmoadmin/index.php/, as it is now understood as parent directory of the script login, instead of the script itself. Hence e.g. all asset URLs are broken.
  • I observed the same problem when trying to beautify URLs in ownCloud and Nextcloud, hence removing the index.php. The rewrite works in one direction, but the backend creates all internal URLs again with index.php.
  • What luckily works is doing rewrites to /tasmoadmin/index.php/?login, hence appending the path as query string instead. Lighttpd then does the split correctly and thank god the backend still handles everything correctly.

I hope that with the same little change, pretty URLs will finally work as well for Nextcloud and ownCloud with Lighttpd.

Please update your TasmoAdmin Lighttpd config and let me know whether there are still issues:

sudo curl -sSfo /etc/lighttpd/conf-available/99-dietpi-tasmoadmin.conf 'https://raw.githubusercontent.com/MichaIng/DietPi/dev/.conf/dps_27/lighttpd.tasmoadmin.3.conf'
sudo systemctl restart php8.2-fpm lighttpd
1 Like