EmonService: get input list failing, code: 301

Hi all,

Please may you assist me.

I have been successfully posting to the emoncms.org server for a while, but I would like to change this to send to my own server. I have tried to setup the IotaWatt to send to my server, of which I have a number of other devices successfully sending data to, but without success.

Here is the message log from last restart:
** Restart **

SD initialized.
5/27/20 13:32:04z Real Time Clock is running. Unix time 1590586324
5/27/20 13:32:04z Reset reason: Software/System restart
5/27/20 13:32:04z Trace: 1:4, 1:3, 1:4, 1:3, 1:4, 1:3, 1:4, 1:3, 1:4, 1:3, 1:4, 1:3, 1:4, 1:3, 1:4, 1:3, 1:4, 1:3, 1:4, 1:3, 1:4, 1:3, 1:4, 1:3, 1:4, 1:3, 1:4, 1:3, 1:4, 1:3, 10:2, 10:3
5/27/20 13:32:04z ESP8266 ChipID: 6991482
5/27/20 13:32:04z IoTaWatt 4.x, Firmware version 02_05_02
5/27/20 13:32:04z SPIFFS mounted.
5/27/20 15:32:05 Local time zone: +2:00
5/27/20 15:32:05 device name: IotaWatt
5/27/20 15:32:06 MDNS responder started for hostname IotaWatt
5/27/20 15:32:06 LLMNR responder started for hostname IotaWatt
5/27/20 15:32:06 HTTP server started
5/27/20 15:32:06 WiFi connected. SSID=Inverter room, IP=192.168.1.2, channel=1, RSSI -81db
5/27/20 15:32:06 timeSync: service started.
5/27/20 15:32:07 statService: started.
5/27/20 15:32:07 Updater: service started. Auto-update class is MAJOR
5/27/20 15:32:07 dataLog: service started.
5/27/20 15:32:10 dataLog: Last log entry 05/27/20 15:32:00
5/27/20 15:32:10 historyLog: service started.
5/27/20 15:32:11 historyLog: Last log entry 05/27/20 15:32:00
5/27/20 15:32:11 EmonService: started. url=monitoring.greenhousesolar.co.za:80/emoncms/, node=4, interval=10
5/27/20 15:32:14 Updater: Auto-update is current for class MAJOR.
5/27/20 15:32:31 EmonService: get input list failing, code: 301

End

I have tried http:// and https://.
I have tried removing the user ID.

Any help will be much appreciated.

301 is a permanent redirect. That usually happens when a service requires https (port 443) and doesn’t respond to http (port 80). I know you say you tried both, but IoTaWatt ignores https specification and sends Emoncms transactions to port 80.

Is this something that can typically be resolved on the server side?

I believe it can only be resolved on the server side.

Please excuse my ignorance, but could you help me formulate the question/inquiry that I should put to my hosting provider in an attempt to resolve?

I can’t be completely sure this is a redirect to port 443, but that’s my best guess. I’m not a server expert. You probably are using apache on Linux? If so, there are other forum users with expertise in that environment and specifically maintaining eMoncms there. Can someone step up here and help?

Hello, did anybody solve this issue? We have the same problem :frowning:
@monitorlizzard ?

301 is the server telling IoTaWatt to use a different URL to talk to it. What is probably happening is that your server wants HTTPS scheme rather than HTTP. IoTaWatt doesn’t support HTTPS directly, so the Emoncms server needs to accept HTTP.

This problem should not happen with Emoncms.org, only with a private instance.

Indeed, the problem does not happen with emoncms.org, only with our private instance. How can we make it work on our private instance?

It’s probably in the hosting service. Where is it hosted?

Thanks for your support.

Emoncms is hosted on our own server (Debian / Apache) with let’s encrypt configured. Our apache configuration is below:

<VirtualHost *:80>
ServerName emoncms.server.com
DocumentRoot /var/www/html/emoncms

<Directory /var/www/html/emoncms>
Options +FollowSymlinks
AllowOverride All
DirectoryIndex index.php
Order allow,deny
allow from all

RewriteEngine on
RewriteCond %{SERVER_NAME} =emoncms.server.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]

Maybe the RewriteEngine is the problem to force the https connection?

and for information, the ssl Apache configuration file for emoncms is:

<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName emoncms.server.com
DocumentRoot /var/www/html/emoncms

<Directory /var/www/html/emoncms>
Options +FollowSymlinks
AllowOverride All
DirectoryIndex index.php
Order allow,deny
allow from all

SSLCertificateFile /etc/letsencrypt/live/emoncms.server.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/emoncms.server.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf

I’m not proficient in Apache, mostly using NGINX for proxies, but I think it’s a safe bet that the redirect is coming from Apache. Maybe a more Apache fluent user reading this will chime in or you can research it yourself.