Redirect to previous URL in Laravel 6 - laravel-6

I am hitting one URL (127.0.0.1/test) as a guest in laravel 6. It will redirect me to the login page and after successful login again redirect to the home page. After login, I want to redirect to 127.0.0.1/test.

Use return Redirect::intended();

Related

Nuxt : Check route is redirected from other routes or directly load?

I'm face up with a problem when login.
If user is authenticated, I will let them redirect to home page.
And if they come from another protected route (homepage, other routes) and after logined, I want it redirect to exactly the route they came from.
My solution is:
In auth.js middleware, I will save to cookie the route they come from like this
app.$cookie.set("historyRoute", app.router.history.current.path)
In login.vue I will check if exist historyRoute to let them redirect then remove historyRoute from cookie.
But problem is that user will come from other protected routes and they do not take login action at that time, they make refreshing Login page many times and historyRoute will still exist in cookie.
So I want to know how to determine when visitors directly reload Login page to remove historyRoute in cookie.
Or if you have another solution, please suggest me know. Thanks.
Update flow:
Visitor access link /users/setting
-> check Auth
-> if Not Auth
-> redirect 302 to /Login
-> After login (I need to know they directly come from login page or from /user/setting then redirect to login page)
-> redirect back to users/setting

Laravel 8 - inertia-jetstream-fortify, redirect to a particular URL before login (i.e. On hit of main URL ex.-www.something.com)

I have a Single sign-in laravel application which is, say for example app-A. And my main application app-B. Now, whenever a user visits www.aap-B.com, I want the user to reach to the login page of app-A.
Since app-B is built using laravel fortify whenever I first hit the site url of app-B it takes me to the login page of app-b. How to edit this login route in laravel since it is coming from vendor/laravel/fortify folder. How to make app-B follow the first endpoint to direct to URL of app-A without going to the defult login route when we hit the URl of app-B for the first time.
I don't know where can I edit this login route in app-B. Any piece of advice would be of great help.

Redirect route after login using nuxt auth module

I use nuxt auth module when I route to a guard page when I don't log in the login page is open but if I don't log in and go to another page not guarded and login successfully, automatically redirect me to the last guarded page I was open before if there is any solution for that? I want to go to the last page I was open after login successfully

Why is my custom domain redirecting to the login page after successful login, where as my default cloudfront domain redirects to the application?

I have a cloudfront distribution which has a default domain. When I login to my application with that it redirects to the application dashboard but when I login with my custom domain it redirects to the login page again. Any idea?

Single Page App (ng2) and .htaccess

Should be a pretty simple question but I have an NG2 app that will run an apache server, when navigating to the app url i.e. localhost:4200 it will check if the user is authenticated and if they arent authenticated it will redirect to the /login url. This works well but if a user refreshes the webpage on the /login url the app wont load (the base href is "/").
Should I setup a 301 redirect in my .htaccess to redirect hits to /login to /?