When I deploy Angular project to gcloud, all the pages can be loaded normally, but when I refresh the page, I will get the error as the title, or if I access it directly by typing the URL, it will be wrong, and I can only access it from the homepage to not make the later pages wrong, this problem has been bothering me for a long time.
My route is as follows:
const routes: Routes = [
{ path: '', redirectTo: '/search/home', pathMatch: 'full'},
{ path: 'search/home', component: SearchComponent },
{ path: 'search/:ticker', component: SearchComponent },
{ path: 'watchlist', component: WatchlistComponent },
{ path: 'portfolio', component: PortfolioComponent },
];
My app.yaml file looks like this:
runtime: nodejs20
handlers:
- url: /
static_files: dist/stock-app/browser/index.html
upload: dist/stock-app/browser/index.html
- url: /
static_dir: dist/stock-app/browser