I have used Angular-11 for frontend and Laravel-8 for backend in a project.
When user signup, there will be notification to activate.
Laravel:
public function toMail($notifiable)
{
return (new MailMessage)
->subject('Confirm your account')
->line('Thanks for signup! Please before you begin, you must confirm your account.')
->action('Confirm Account', url('https://myapp/auth/signup-activate?token='.$notifiable->activation_token))
->line('Thank you for using our application!');
}
Angular:
App.routing:
{path: 'auth', loadChildren: () => import('./features/auth/auth.module').then(m => m.AuthModule)},
Auth.routing:
{
path: 'signup-activate',
component: SignupConfirmComponent
}
When the user clicks the link in his email notification;
https://myapp/auth/signup-activate?token=92KoHrO59b
It suppose to take to the signup-activate, but got this error:
404 Not Found nginx/1.18.0 (Ubuntu)
But the route exists.
I observe that it has to do with the production server. For instance, if I type the url below on browser and hit enter key, gives the 404 error"
https://myapp/auth
But if I put it on routerLink, and click the button, it works.
Also, this works:
<li><a routerLink="/auth/signup" class="dropdown-item"><i class="far fa-user"></i> Signup</a></li>
But if I type the same url and hit enter key, it doesn't work
Note: All these happen on production serve. But everything works fine on local system.
How do I resolve this?
Thanks