itsgoingd / clockwork

Clockwork - php dev tools in your browser - server-side component
https://underground.works/clockwork
MIT License
5.7k stars 320 forks source link

Inconsistent web redirect - laravel #546

Closed ssnepenthe closed 2 years ago

ssnepenthe commented 2 years ago

This likely affects lumen and symfony as well, but I haven't tested either.

On a fresh laravel + clockwork install you can reproduce by visiting the web redirect route with a trailing slash (__clockwork/). You will be redirected to __clockwork/__clockwork/app instead of __clockwork/app. The same happens if you set a custom web path.

I am pretty sure this is down to the fact that your web redirect is relative (no leading slash) with browsers interpreting it as relative to that last slash.

Easy ways to address this:

  1. Including a leading slash in the redirect (return new RedirectResponse('/' . $request->path() . '/app');)
  2. Using the laravel redirect() helper which converts the path to an absolute URL (return redirect($request->path() . '/app');) I don't know what the equivalent is for lumen or symfony.

Thoughts?

itsgoingd commented 2 years ago

Yeah, adding leading slash seems to be a good solution, the same applies for Lumen and Symfony. Would you like to make a PR for this one?