libelektra: website-frontend: all links do not work

Steps to Reproduce the Problem

~e/scripts/dev/configure-debian -DCMAKE_INSTALL_PREFIX=/srv -DTOOLS="ALL;website frontend" ~e
make -j 5 install
/srv/lib/elektra/tool_exec/mount-website-frontend-config
/srv/lib/elektra/tool_exec/run-website-frontend
#> Running "connect:server" (connect) task
#> Waiting forever...
#> Started connect web server on http://localhost:9000

Expected Result

That I can visit http://localhost:9000 and see something like https://www.libelektra.org

Actual Result

For every <page>, I get an error Cannot GET /<page>, the html source for root is:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /</pre>
</body>
</html>

System Information

  • Elektra Version: master
  • npm --version: 5.8.0

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (16 by maintainers)

Most upvoted comments

Is it possible that the problem is that kdb set system/sw/elektra/websitefrontend/#0/current/website/content_root /? Does this change on which URL pages are delivered or does this change from where source files are looked up?

Yes, I think so. The content_root defines the directory where dynamic contents are stored, which is /srv/share/elektra/tool_data/website/public/website in your case. Since the script which uses this path is executed in the public/ directory, it needs to prefix lookups with the website/ sub path.

The content_root is configurable, but it makes no sense to do so I think. Or maybe it would require a full reinstallation of Elektra, not sure. It has been a long time. 👍

Which CMake script? From the frontend?

Yes, this one here: https://github.com/ElektraInitiative/libelektra/blob/399856a673b25858e02b117f5787fb902e6485ad/src/tools/website-frontend/CMakeLists.txt#L18

But be careful, the variable is used in other files of the frontend as well.


/srv/lib/elektra/tool_exec/mount-website-config
/srv/lib/elektra/tool_exec/build-website
ls /srv/share/elektra/tool_data/website/public                                                                                                                                                                                       
#> assets  index.html  news  pages  templates  vendor  website

I’ve installed it in a different path (using Debian Buster in WSL 2), but when I use the built-in PHP webserver to test it, it works perfectly fine for me.

$> cd /usr/local/share/elektra/tool_data/website-frontend/public
$> php -S localhost:9000

Opening http://localhost:9000 in the browser yields the expected home page with working internal and external links. Entering http://localhost:9000/something/not/existing will redirect me to the /error/404 page of the SPA and entering http://localhost:9000/news/0.8.17-release yields a 404 error of the webserver, but that must have to do with the routing I guess (as explained earlier).