Horizon: Horizon Page Open + redirect()->back()

Created on 4 Aug 2019  路  7Comments  路  Source: laravel/horizon

  • Horizon Version: 3.2.7
  • Laravel Version: 5.8.30
  • PHP Version: 7.3.7-2
  • Redis Driver & Version: predis/phpredis 4.0.9 (redis-cli in homestead)
  • Database Driver & Version: mysql server version 5.7.27

Description:

redirect()->back() is giving me "302 Found" to random horizon routes:
Such as
... Redirecting to horizon/api/workload ...
... Redirecting to horizon/api/stats ...
When I have the horizon tab open in my browser, this happens to all tabs in short times.

Steps To Reproduce:

  1. Add this route to web.php
Route::get('/test/redirect-bug', function() {
    dd(redirect()->back());
});
  1. Open horizon on a tab in your browser.
  2. Visit "/test/redirect-bug" and keep refreshing the page. You will see the title part of "Redirecting to" in the response object's content.

Note

I am unsure if it's the default wanted behavior, if so, how can I evade this?
Thanks.

bug

All 7 comments

Can you post your entire web.php routes file?

It is actually not much..

Route::get('/test/redirect-bug', function() {
    dd(redirect()->back());
});
Route::get('/test/empty', function() {
    return view('empty');
});

I try to visit /test/empty without having horizon open in a browser tab, and it works fine.
When horizon is open, this bug happens. It happens regardless of horizon's auto load entries.

The problem might be in the startSession middleware that isn't able to detect the /horizon/api/-routes as ajax request.

I can't reproduce this. Something tells me that there's still something missing here. Can you first please try one of the support channels below? If you can actually identify this as a bug, feel free to report back and I'll gladly help you out and re-open this issue.

Thanks!

@driesvints I was able to reproduce this;

  1. Have a horizon instance running
  2. Have the horizon index page open in a separate tab
  3. dump the result of \Illuminate\Support\Facades\URL::previous()

This will return /horizon/api/workload or any other API address as Vue does not set the header X-Requested-With to XMLHttpRequest

Exactly my thoughts on the session and AJAX thing 馃憤

@SDekkers hmm indeed. I can see the horizon routes there.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rossuhms picture rossuhms  路  5Comments

crash13override picture crash13override  路  5Comments

Pustiu picture Pustiu  路  5Comments

okaufmann picture okaufmann  路  3Comments

lasselehtinen picture lasselehtinen  路  3Comments