Search code examples
angularwebsphere

How to deploy angular-cli app on Websphere?


I have simple angular 7 app.I made production Build with ng build -- href .once the build is done we placed the dist folder to the server location. application works fine but when i refresh the application the server(WebSphere) is not able to get the routing path of the application.it works fine only when we redirect to index.html

Angular side i have used Routing Strategies as given below .

const appRoutes: Routes = [
  { path: '', component: DashboardComponent },

];

@NgModule({
  imports: [RouterModule.forRoot(appRoutes, { useHash: true })],
  exports: [RouterModule]
})

Solution

  • Updated the web.xml file in WebSphere with the below error status code.Mention the path of deployed angular application.

    <error-page>
        <error-code>404</error-code>
        <location>/path/sampleapp/index.html</location>
    </error-page>