laravel / horizon

Dashboard and code-driven configuration for Laravel queues.
https://laravel.com/docs/horizon
MIT License
3.88k stars 659 forks source link

Failure on retrieving job metric details in the horizon dashboard #1326

Closed goestijn closed 1 year ago

goestijn commented 1 year ago

Horizon Version

5.21.1

Laravel Version

9.52.15

PHP Version

8.0.26

Redis Driver

PhpRedis

Redis Version

5.3.7

Database Driver & Version

No response

Description

We are running horizon in a containerized environment on an azure app service. We are facing troubles when we try to retrieve the details of the job metrics. The call to the api request that is done on that page is returning static html instead of the appropiate json-data. The behavior does not occur on my local development environment.

I've done some research and I noticed encoded characters in the url: (../horizon/api/metrics/jobs/App%5CJobs%5CTest). I also found an article (https://learn.microsoft.com/en-us/answers/questions/1293667/azure-container-app-ingress-decoding-url) that explains azure is applying some pre-urldecoding before requests are actually reaching the app service. As a possible solution their advice is to apply double encoding. So in case in example replacing the %5C characters in the url by %255C. This approche also actually works on our environment.

Is it possible to commit a change to the library that applies double encoding to this endpoint or simply makes the endpoints more url friendly by replacing the backslashes in the url by dashes.

Steps To Reproduce

driesvints commented 1 year ago

Heya. Could you maybe send in a PR we can look at? That would give us a better picture at the issue and the solution.

goestijn commented 1 year ago

1327

Solution in the pr encodes the job metrics slugs to a base64 string before the call is done to the API. By encoding the slugs presence of slashes or backslashes in the request-uri is prevented.

driesvints commented 1 year ago

Seems we aren't going to change anything here right now, sorry.