2

when I hithttp://localhost:4200 or http://localhost:4200/forgotPasswordEmail on my local environment, it works correctly.

Opening the index-page on my production environment and clicking a link to go to another page, also works. However, when I refresh the page or go directly to http://<prod url>/forgotPasswordEmail, it doesn't work and then I get the following error:

error page

I guess that when I hit the URL, it's trying to search the rest API code for forgotPasswordEmail and it's not able to find the value so it's returning 401 but locally it's working fine.

  • What kind of server is serving the angular app? – Octavian Mărculescu Mar 30 '22 at 09:43
  • This happens because Angular doesn't really serve anything at `/forgotPasswordEmail`. Frameworks like Angular use a JavaScript API to do that. To make this work, you need to configure the web server to redirect all calls back to `index.html` so that your Angular app can handle it. For Spring boot, this is covered in [this question](https://stackoverflow.com/q/43913753/1915448). – g00glen00b Mar 30 '22 at 10:02
  • Thanks for the post and I am trying this solution – syedali cse Mar 30 '22 at 10:52
  • no luck from this – syedali cse Mar 30 '22 at 14:57

2 Answers2

1

In your server config, you need to render index.html every route that is not a static file or folder. Routing should be handled by the angular application, not the server.

Ali Demirci
  • 5,185
  • 6
  • 35
  • 62
0

I will achieve this through

security.basic.enable: false
security.ignored=/**
Agneum
  • 608
  • 3
  • 17