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.
Route::get('/test/redirect-bug', function() {
dd(redirect()->back());
});
I am unsure if it's the default wanted behavior, if so, how can I evade this?
Thanks.
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;
\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.