New install on Ubuntu 18.04 returns only 400 Bad Request

On various Hardware and OS systems: pi / windows / routers / nas, etc

Moderator: leecollings

Post Reply
paul444
Posts: 1
Joined: Thursday 22 October 2020 16:21
Target OS: Linux
Domoticz version:
Contact:

New install on Ubuntu 18.04 returns only 400 Bad Request

Post by paul444 »

Hello,

Newbie here, please have mercy.

I have installed Domoticz on my server running Ubuntu 18.04 behind an Apache reverse proxy. I have a number of services running on this server so Domotics will need to stick to its area under the root /domoticz (i.e. https://myserver.com/domoticz).

I will want to start it normally using systemd but I'm now just running it from the command line to see if I can get it to work (spoiler: I can't).
* I have put the application in /opt/domoticz
* I created a working directory /var/domoticz-wd
* I created user and group domoticz and chown'ed all the directories and files to that user:group.

Now my problem that:
* if I start it using the below command, on the initial page, all the links to images etc are broken because the paths don't include the "domoticz" after the hostname.

Code: Select all

sudo -u domoticz /opt/domoticz/domoticz -www 8110 -sslwww 4444 -dbase /opt/domoticz/domoticz.db -log /var/log/domoticz.log -verbose 5 -userdata /var/domoticz-wd/


* I understand I need to add the -webroot option, but if I do that, then the server will only return "400 Bad Request"

Code: Select all

sudo -u domoticz /opt/domoticz/domoticz -www 8110 -sslwww 4444 -dbase /opt/domoticz/domoticz.db -log /var/log/domoticz.log -verbose 5 -userdata /var/domoticz-wd/ -webroot /domoticz
My Apache config for this location looks like this:

Code: Select all

<Location /domoticz >
   ProxyPass http://192.168.1.12:8110/
   ProxyPassReverse http://192.168.1.12:8110/
</Location>

<Location "domoticz/json">
   ProxyPass "ws://192.168.1.12:8110/json"
</Location>
The Apache log just shows the request coming in and 400 being returned:

Code: Select all

[22/Oct/2020:14:25:35 +0000] "GET /domoticz HTTP/1.1" 400 4292 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.80 Safari/537.36"
The Domoticz log seems perfectly happy:

Code: Select all

2020-10-22 14:25:29.580  Status: Domoticz V2020.2 (c)2012-2020 GizMoCuz
2020-10-22 14:25:29.580  Status: Build Hash: b63341bc0, Date: 2020-04-26 11:47:55
2020-10-22 14:25:29.598  Status: Startup Path: /opt/domoticz/
2020-10-22 14:25:29.620  Status: PluginSystem: Started, Python version '3.6.9'.
2020-10-22 14:25:29.621  Active notification Subsystems: fcm, http (2/13)
2020-10-22 14:25:29.621  Status: WebServer(HTTP) started on address: :: with port 8110
2020-10-22 14:25:29.622  Status: WebServer(SSL) started on address: :: with port 4444
2020-10-22 14:25:29.623  Starting shared server on: :::6144
2020-10-22 14:25:29.623  Status: TCPServer: shared server started...
2020-10-22 14:25:29.623  Status: RxQueue: queue worker started...
2020-10-22 14:25:31.624  Status: NotificationSystem: thread started...
2020-10-22 14:25:31.624  Status: EventSystem: reset all events...
2020-10-22 14:25:31.624  Status: EventSystem: reset all device statuses...
2020-10-22 14:25:31.641  Status: Python EventSystem: Initalizing event module.
2020-10-22 14:25:31.642  Status: EventSystem: Started
2020-10-22 14:25:31.642  Status: EventSystem: Queue thread started...
2020-10-22 14:25:32.105  Status: PluginSystem: Entering work loop.

User hits Ctrl-C

2020-10-22 14:25:40.625  Status: Closing application!...
2020-10-22 14:25:40.625  Status: Stopping worker...
2020-10-22 14:25:40.625  Status: RxQueue: queue worker stopped...
2020-10-22 14:25:41.126  Status: WebServer(HTTP) stopped
2020-10-22 14:25:41.627  Status: WebServer(SSL) stopped
2020-10-22 14:25:41.627  Status: TCPServer: shared server stopped
2020-10-22 14:25:41.627  Status: Stopping all hardware...
2020-10-22 14:25:41.628  Status: Scheduler stopped...
2020-10-22 14:25:41.628  Status: EventSystem: Queue thread stopped...
2020-10-22 14:25:41.628  Status: EventSystem: Stopped...
2020-10-22 14:25:41.634  Status: EventSystem - Python stopped...
2020-10-22 14:25:41.634  Status: NotificationSystem: thread stopped...
2020-10-22 14:25:41.635  Status: PluginSystem: Exiting work loop.
2020-10-22 14:25:41.637  Status: PluginSystem: Stopped.
2020-10-22 14:25:41.637  Status: Mainworker Stopped...
Any clue what's happening here? Many thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest