Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Horizon Page Open + redirect()->back() #639

Closed
knno opened this issue Aug 4, 2019 · 7 comments
Closed

Horizon Page Open + redirect()->back() #639

knno opened this issue Aug 4, 2019 · 7 comments
Labels

Comments

@knno
Copy link

knno commented Aug 4, 2019

  • 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 "<sitename.com>/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.

@driesvints
Copy link
Member

Can you post your entire web.php routes file?

@knno
Copy link
Author

knno commented Aug 5, 2019

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.

@SDekkers
Copy link
Contributor

SDekkers commented Aug 5, 2019

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

@driesvints
Copy link
Member

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!

@SDekkers
Copy link
Contributor

SDekkers commented Aug 5, 2019

@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

@knno
Copy link
Author

knno commented Aug 5, 2019

Exactly my thoughts on the session and AJAX thing 👍

@driesvints
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants