Lighttpd install API input issue

I have an install of emoncms that I have done on DietPi Stretch, using Lighttpd.

I have modified the node-red emoncms node to successfully work with a ‘standard’ (Jessie) Rasbian install.

When I try and use exactly the same node and data to the Lighttpd install, I get a response from emoncms “success:false” and “Username or password empty”. I can see where that error might be generated from in the emoncms source code, but have no idea why or how I might fix it.

It may be related to the issue I have with updating (this is a 9.8.24 install currently), but I suspect not.

I’ve managed to update this install, but am still seeing a response from Emoncms “Username or password empty” when trying to use the input API.

My thoughts are the authentication with Lighttpd must be incorrectly configured but not sure how to fix it.

Any suggestions?

Ok, so to install emoncms using lighttpd, I had to add some rewrite rules as laid out in this thread. They were;

url.rewrite-if-not-file = (
"^/emoncms/([^?])?(.)$" => “/emoncms/index.php?q=$1”,
"^/emoncms/([^?])$" => “/emoncms/index.php?q=$1”,
"^/emoncms/([^?])(?(.+))?$" => “/emoncms/index.php?q=$1”
)

I am fairly sure that this is the issue with the API input but I am not sure what to rewrite the URI to. Is it simply passed through complete on Apache installations?

I have written this regex…

"^/emoncms/input/[^?]+\?[^?]+$" => "$0"

which matches any URI with input and a ? and passes it through unchanged but I get a 404 off that.

I really need to know what emoncms expects the Input API URI to look like when it gets it!

This is like having a conversation with myself… :smile:

So I have solved the problem. The previously suggested lines for the lighttpd.conf file were not quite right. they should be

url.rewrite-if-not-file = (
"^/emoncms/([^?]*)$" => "/emoncms/index.php?q=$1",
"^/emoncms/([^?]*)\?(.*)$" => "/emoncms/index.php?q=$1&$2"
)

Everything is working fine both in the Emoncms pages, MQTT input and the API.