Closed ayuser123 closed 1 year ago
Hi @ayuser123,
could you share with me:
log produced from API request: 172.29.0.1 - - [31/Jul/2023:17:59:31 -0400] "POST /Web/Services/index.php/Authentication/Authenticate/ HTTP/1.1" 500 805 "-" "-" [Mon Jul 31 17:59:31.328416 2023] [core:alert] [pid 49] [client 172.29.0.1:53546] /var/www/html/Web/Services/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration
Request/Reply (invoked using Postman):
Hi @ayuser123,
I believe that the module headers
is not enabled in the image/container.
Could you please try the following command:
sudo docker exec -t librebooking bash -c "a2enmod headers && service apache2 restart"
If you confirm it works, then I will make the changes and issue a new image release.
Hi,
Yes enabling the headers in the apache server helped with the 500 error. Note that I had to edit the config.php file manually to enable the API, it is not enabled by default (and not configurable from the web GUI).
However now the reply is returned with an empty body.
logs from the terminal show the following error: [Wed Aug 02 14:31:10.182660 2023] [php:warn] [pid 44] [client 172.29.0.1:44208] PHP Warning: Undefined array key "request" in /var/www/html/lib/WebService/Slim/SlimServiceRegistration.php on line 120
Bug:
a2enmod Headers
to DockerfileBug:
lib/Common/Date.php
to $minutes = intval($this->seconds / 60) % 60;
Investigation:
Hi @ayuser123 ,
I found an issue/bug with the program lib/Common/Date.php as shown above. Once I fixed the line:
Could you try to make the same program modification inside your running container?
Hi,
Thanks for all your help with this!
Local changes summarized:
I am able to get the /Web/Services description page, but note that this was working for me earlier as well.
Unfortunately, I'm still getting the same "empty" reply body with the "Undefined array key" warning as described earlier.
What build of the docker image are you testing with?
Hi,
I am using the image: librebooking/librebooking:develop-2.1.0
.
I just confirmed that the authentication does not work with the stable version librebooking/librebooking:2.8.6-2.1.0
. A fix was brought to the upstream project after the release 2.8.6 was published.
Here are the steps that I am following:
docker compose down -v
docker compose up -d
http://localhost/Web/install
docker exec -t librebooking a2enmod headers
docker exec -t librebooking service apache2 restart
docker exec -t -u www-data librebooking sed -E 's:(.*api.*enabled.* = .)false:\1true:' -i config/config.php
docker exec -t -u www-data librebooking sed -i lib/Common/Date.php -e 's:minutes = intval((\$this->seconds / 60) % 60);:minutes = intval(\$this->seconds / 60) % 60;:'
curl -X POST http://localhost/Web/Services/Authentication/Authenticate -H 'Content-Type: application/json' -d '{"username":"admin","password":"LibrebookinG"}'
If you confirm the above works for you as well, then I will:
yes, thanks, we are now able to authenticate on a different docker instance using the above steps! :)
{
"links": [
{
"href": "[http://x.x.x.x:8080/Web/Services/Authentication/SignOut"](http://x.x.x.x:8080/Web/Services/Authentication/SignOut%22),
"title": "logout"
}
],
"message": null,
"sessionToken": "d107894fd92d46821cc641cfdc7c1fc94e80059ad31cccb321",
"sessionExpires": "2023-08-04T20:56:17+0000",
"userId": "2",
"isAuthenticated": true,
"version": "2.8"
}
Is there a way to do this without deleting the existing volumes? If I destroy only the librebooking_html volume, will the user/reservation/schedules/resources/etc. data be lost?
Well done @ayuser123 !
The reason I wanted you to delete the 2 volumes was to make sure the fix worked on a "clean" environment.
At this stage, I believe that you can keep your 2 volumes, as long as you perform steps 4 through 6 on your running librebooking instance.
This issue will be closed, when I create the docker release 2.1.1 (with the Dockerfile fix). New images will be available on the docker hub, but the api won't work since the bug comes from the upstream project. Eventually, the bug (Date.php) will be fixed in upstream and made available on a future docker image.
Hi,
Running docker build 2.8.6-2.1.0 (https://hub.docker.com/layers/librebooking/librebooking/2.8.6-2.1.0/images/sha256-32b6cbd1641d6e78b80ca8f259b3051edb5e744f0f83a8b88db4f2d879bdfb73?context=explore), I'm trying to use the REST API to manage librebooking, but my requests are getting an "HTTP 500 Internal Server Error" reply.
Logs show "/var/www/html/Web/Services/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration"