React Website Created Using Create-react-app Deployed On Apache Tomcat Giving Blank Screen

Created a react app using create-react-app. Everything works fine on local system but getting issues when deploying it on Apache tomcat. Below are the steps i followed for deployment:

  1. Added "homepage":"" in package.json.
  2. Create .htaccess file in public folder of project and added below code

    Options -MultiViews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.html [QSA,L]

  3. Run "npm run build" to create build files.

  4. Copied the content of build file into 'react_web' folder in Apache tomcat.

There are no errors in console of browser.


<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="manifest" target="_blank" rel="nofollow noreferrer" href="//"><link rel="shortcut icon" target="_blank" rel="nofollow noreferrer" href="//"><title>React App</title><link target="_blank" rel="nofollow noreferrer" href="//" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script type="text/javascript" src="//"></script></body></html>

Below are few pics from browser console.

enter image description here

I am using BrowserRouter for routing. Do i have to change something there.

Also i see all the project files being loaded properly in console.

Any suggestion or direction will be helpful.



I found the issue. Was missing below part.

Note: If you are using [email protected]^4, you can root <Link>s using the basename prop on any <Router>.

<BrowserRouter basename="/calendar"/>
<Link to="/today"/>
// renders <a target="_blank" rel="nofollow noreferrer" href="/calendar/today">