skip to Main Content

I have an application based on github Angular web app

I have problem with the link I am sending to the registering user in an email which looks like this (inside the Microsoft outlook):

http://rejkid.hopto.org:8080/account/verify-email?token=CA9E3D9587D1884644F70F321AE29847B83D1014F6DCB2552B705B533D583C7A0CDBA57389D92C6C

It is supposed to run browser and activate the route to create angular component (VerifyEmailComponent) defined in my AccountRoutingModule:

const routes: Routes = [
    {
        path: '', component: LayoutComponent,
        children: [
            { path: 'login', component: LoginComponent },
            { path: 'register', component: RegisterComponent },
            { path: 'verify-email', component: VerifyEmailComponent },
            { path: 'forgot-password', component: ForgotPasswordComponent },
            { path: 'reset-password', component: ResetPasswordComponent }
        ]
    }
];  

The rejkid.hopto.org is my computer name.
If I use instead of rejkid.hopto.org the localhost it work just fine, but using rejkid.hopto.org creates for some reason a problem.

I am running Tomcat as my web server (I tried ISS but I get the similar problem).

When I execute that link using Postman I get the error
The requested resource [/account/verify-email] is not available</p> <p><b>Description</b> The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

So It seems to me the web server has problem locating "/account/verify-email" resource in my angular app, but the resource definitely exists because it is OK if I use localhost in my URL?.

Update:
It does not work with localhost in URL. It only works if I run ng serve from Visual Studio Code.

2

Answers


    • You are trying to access the resource with rejkid.hopto.org. But your system doesn’t know what rejkid.hopto.org is.

    • You need to point the URL to the localhost.

    • Add the below line in C:WindowsSystem32driversetchosts file (For Windows)

      127.0.0.1 rejkid.hopto.org

    Login or Signup to reply.
  1. check on this link https://angular.io/guide/deployment#routed-apps-must-fall-back-to-indexhtml.
    Routed apps must fall back to index.html

    A routed application should support "deep links". A deep link is a URL that specifies a path to a component inside the application. For example, example.com.com/heroes/42 is a deep link to the hero detail page that displays the hero with id: 42.

    There is no issue when the user navigates to that URL from within a running client. The Angular router interprets the URL and routes to that page and hero.

    But clicking a link in an email, entering it in the browser address bar, or merely refreshing the browser while on the hero detail page —all of these actions are handled by the browser itself, outside the running application. The browser makes a direct request to the server for that URL, bypassing the router.

    A static server routinely returns index.html when it receives a request for example.com.com/. But it rejects example.com/heroes/42 and returns a 404 – Not Found error unless it is configured to return index.html instead.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search