Kimai2: PATCH http request not working behind Proxy

Created on 18 Sep 2019  路  4Comments  路  Source: kevinpapst/kimai2

Hi there,

I have installed kimai2 on an Ubuntu 18.03 LTS server on Azure. Everything is working fine while browsing the site from home but when i am at the office, i am facing this issue. Although the "Start" activity function from the top right corner is working perfectly, when trying to press the "Stop" activity button for a task, i get the error shown here --> https://imgur.com/XNzKDuI.

After further investigation with the logs enable, i saw that from home the command send and worked was http PATCH:

x.x.x.x - - [18/Sep/2019:14:32:15 +0000] "PATCH /api/timesheets/12/stop HTTP/1.1" 200 245 "h**p://y.y.y.y/en/dashboard/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36"

While trying to analyse the issue furthermore, i found out that our proxy (Cisco WSA), does not support the http patch command at the current version we are using.

Is there a way to alter the code and make the PATCH command be send like POST ?

The guide that i have followed to make the installation, was this --> https://www.kimai.org/documentation/fresh-ubuntu-18.html

Thank you for your time

support

Most helpful comment

I might be overstepping my knowledge base and bounds here, but this seems to be a known bug https://quickview.cloudapps.cisco.com/quickview/bug/CSCuj39346
Wouldn't it be easier to request an upgrade to the Cisco firmware, supposing it's been resolved by them, than doing a lot of code re-writing yourself?

All 4 comments

Hi!

Thanks for posting and sharing your findings. You obviously put already some time into debugging. Great! I would have never been able to help with that issue, which I also never heard of before.

You know: everything is possible if you are willing to put some time into it. I will not make changes in the core application, as this is obviously an issue by the proxy configuration. But I can guide you to the code pieces, which needs adjustment.

This is definitely not an Kimai issue, but I am available for paid changes. Without PHP/Symfony knowledge it will become rather complicated. but here are some starter tipps.

The javascript "links" to the stop actions. Change the auto-generated route names and PATCH to POST:
https://github.com/kevinpapst/kimai2/blob/master/templates/timesheet/actions.html.twig#L26
https://github.com/kevinpapst/kimai2/blob/master/templates/timesheet-team/actions.html.twig#L25
https://github.com/kevinpapst/kimai2/blob/master/templates/navbar/active-entries.html.twig#L18

And this is the API stop action (rename to "postStopAction"):
https://github.com/kevinpapst/kimai2/blob/master/src/API/TimesheetController.php#L540

Some additional JS code is required to handle POST API calls:
https://github.com/kevinpapst/kimai2/blob/master/assets/js/plugins/KimaiAPI.js#L36
https://github.com/kevinpapst/kimai2/blob/master/assets/js/plugins/KimaiAPILink.js#L84

You need a local developer setup and rebuild the frontend assets afterwards:
https://www.kimai.org/documentation/installation.html#development-installation

I might be overstepping my knowledge base and bounds here, but this seems to be a known bug https://quickview.cloudapps.cisco.com/quickview/bug/CSCuj39346
Wouldn't it be easier to request an upgrade to the Cisco firmware, supposing it's been resolved by them, than doing a lot of code re-writing yourself?

Thanks @acmeraptor ! I double that opinion.

I hope you can solve the issue quickly @roulious
Closing here as this is not a Kimai bug and feedback was provided.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. If you use Kimai on a daily basis, please consider donating to support further development of Kimai.

Was this page helpful?
0 / 5 - 0 ratings