[vz-users] middleware errors out with "Unknown context: 'middleware.php'"

Jens Scheidtmann jens.scheidtmann at gmail.com
Fr Dez 2 17:47:30 CET 2022


Hello Volkszaehler community,

I have set-up volkszaehler.org and vzlogger on a Raspi 3B according to the
documentation in the wiki. I chose to install directly, ie. using the
install.sh scripts. I installed both as services in the Raspi.

I can log random values to the demo server at demo.volkszaehler.org using
vzlogger and they are displayed in the web interface.

BUT when using an appropriate uuid and http://localhost/middleware.php as
middleware, I get the following error message in vzlogger.log:

```
[Dec 02 16:57:16][http:/URL:
http://localhost/middleware.php/data/bf85a8b0-723c-11ed-8470-c97c475d509f.json
[Dec 02 16:57:16][chn0] JSON request body: [ [ 1669996636107,
19.155198224319786 ] ]
[Dec 02 16:57:16][chn0] CURL:   Trying ::1:80...
[Dec 02 16:57:16][chn0] CURL: connect to ::1 port 80 failed: Connection
refused
[Dec 02 16:57:16][chn0] CURL:   Trying 127.0.0.1:80...
[Dec 02 16:57:16][chn0] CURL: Connected to localhost (127.0.0.1) port 80
(#0)
[Dec 02 16:57:16][chn0] CURL: Sent 41 bytes: '[ [ 1669996636107,
19.155198224319786 ] ]'
[Dec 02 16:57:16][chn0] CURL: upload completely sent off: 41 out of 41 bytes
[Dec 02 16:57:16][chn0] CURL: Mark bundle as not supporting multiuse
[Dec 02 16:57:16][chn0] CURL: Received 105 bytes:
'{"version":"0.3","exception":{"message":"Unknown context:
'middleware.php'","type":"Exception","code":0}}'
[Dec 02 16:57:16][chn0] CURL: Closing connection 0
```

I am at commit 240c882f3cb427d2ad3a1ded200ebb8ceac1e1d5 (HEAD -> master,
origin/master, origin/HEAD) for volkszaehler.org and commit
27eb8d1566ec493d9cf64d2b53676c846ebb6e35 (HEAD -> master, origin/master,
origin/HEAD) for vzlogger.

What could be the cause?
What information do you need in addition?

Thanks in advance, Jens

The vzlogger config is:
{
  "retry": 0,
  "verbosity": 15,
  "log": "/var/log/vzlogger.log",
  "push": [],
  "local": {
    "enabled": false,
    "port": 8080,
    "index": false,
    "timeout": 0,
    "buffer": 0
  },
  "meters": [
    {
      "enabled": true,
      "allowskip": false,
      "protocol": "random",
      "interval": 5,
      "min": -5.0,
      "max": 40.0,
      "channel": {
          "uuid": "e1466320-725b-11ed-bf33-d7056616a5b3",
          "middleware": "http://demo.volkszaehler.org/middleware.php"
      }
    }
  ]
}

Output of "git diff" in the volkszaehler.org directory follows:

diff --git a/etc/middleware.json b/etc/middleware.json
index 30a128c..e818bc3 100644
--- a/etc/middleware.json
+++ b/etc/middleware.json
@@ -1,8 +1,8 @@
 {
        "host": "0.0.0.0",
-       "port": 8080,
+       "port": 80,
        "workers": 8,
-       "static-directory": "htdocs",
+       "static-directory": "/var/www/volkszaehler.org/htdocs",
        "logging": 0,
        "max-requests": 1000,
        "bridge": "HttpKernel",
diff --git a/htdocs/js/options.js b/htdocs/js/options.js
index f738481..2ad00d9 100644
--- a/htdocs/js/options.js
+++ b/htdocs/js/options.js
@@ -38,8 +38,8 @@ vz.options = {
        shortenLongTypes: false,        // show shorter type names in table
        middleware: [
                {
-                       title: 'Local (default)',
-                       url: 'api'
+                       title: 'Eichenstr 68',
+                       url: ''
                        // live: 8082                                   //
NOTE: live updates require

                                        //    - push-server running and

                                        //    - either apache proxy
forwarding configured according to
-------------- nächster Teil --------------
Ein Dateianhang mit HTML-Daten wurde abgetrennt...
URL: <http://demo.volkszaehler.org/pipermail/volkszaehler-users/attachments/20221202/8d981ab3/attachment.html>


Mehr Informationen über die Mailingliste volkszaehler-users