susanBuck / e15-spring21

1 stars 0 forks source link

Unexpected Redirects #35

Closed sneadthaman closed 3 years ago

sneadthaman commented 3 years ago

Repository URL https://github.com/sneadthaman/e15/tree/main/p3

Production URL

Describe the problem Some of the routes are working as expected ('/' , '/{slug}') but other routes in the same auth group are being redirected back to '/'. I've looked for clues on this Stack forum (https://stackoverflow.com/questions/35020477/laravel-unexpected-redirects-302#45356645) but can't figure this out.

To Reproduce Steps to reproduce the behavior:

  1. Go to project homepage ('/' and login as either Jill or Jamal)
  2. Click on Projects link in the navigation

Additional context I have 3 projects seeded in the db so there is definitely data that the route could use

susanBuck commented 3 years ago

Hi @sneadthaman - I'm not seeing links to login - am I missing something? : )

sneadthaman commented 3 years ago

If you run the app locally, the login screen appears automatically for non-logged in users image

use pw: asdfasdf

susanBuck commented 3 years ago

Ah ok, I was looking at your production site. I will clone locally to test now.

susanBuck commented 3 years ago

The /{slug} route is ambiguous with the /projects route.

So what is happening when your visit /projects is it's triggering DashboardController::class, 'show' which upon not finding a customer slug, is redirecting back to /:

To address this, rearrange your routes so /projects is first and takes precedence over /{slug}.

sneadthaman commented 3 years ago

Working!! Thank you so much