I am creating web app with ReactJS frontend and Java EE + tomcat backend. I'm using React Router for routing. On localhost everything works fine, but on a deployed version I am getting errors.
<Route exact path='/' component={LandingPage} />
<Route path='/howitworks' component={HowItWorks} />
<Route path='/about' component={About} />
<Route path='/pricing' component={Pricing} />
<Route path='/appartment/:id' render={(props) => <Appart {...props} />} />
<Route exact path='/appartments' render={() => <Appartment />} />
In tomcat web.xml file I have added:
<error-page>
<error-code>404</error-code>
<location>/index.html</location>
</error-page>
So everything works just fine except for:
<Route path='/appartment/:id' render={(props) => <Appart {...props} />} />
which WORKS on localhost. The error I am getting is HTTP 404.
Any suggestions? Thanks!
Edit: web.xml content
<web-app>
<context-param>
<param-name>ImagesFolder</param-name>
<param-value>/images</param-value>
</context-param>
<servlet>
<servlet-name>Jersey Web Application</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.web.rest</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey Web Application</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<error-page>
<error-code>404</error-code>
<location>/index.html</location>
</error-page>
</web-app>