I'm trying to deploy a React app in Jenkins using Tomcat 9. Everything is working except when I try to enter an invalid route in the browser's address bar. It only displays the Tomcat 404 page instead of my custom 404 page.
The solution I found in the documentation led me to this answer. Now, the problem is how can I dynamically add a web.xml
file inside the war file that gets built and deployed in Jenkins? I have tried adding it inside my project's public
folder, but it only gets added inside the build
folder.
CodePudding user response:
It turns out, the web.xml
file is indeed getting added inside the war file when I put it inside the public folder but routes are still not working.
I tried deploying my React app using the Maven project instead of a Freestyle project and found out that the web.xml
file is inside the WEB-INF
folder.
I just had to create that folder inside public
and add my web.xml
in there.