I'm creating a simple healthcheck for my app. So far I've created it like this:
Routes:
<BrowserRouter basename="/" history={history}>
<Routes>
<Route path="health-check.html" element={<HealthCheck />} /> //THIS IS MY HEALTHCHECK PAGE
<Route element={<MainLayout pathname={history.location.pathname} />}>
<Route path="login" element={<Login />} />
<Route path="app/reports/*" element={<PrivateRoute component={Reports} />} />
<Route path="app/builder" element={<PrivateRoute component={Builder} />}>
<Route path="" element={<Navigate to="categories" replace />} />
<Route path="categories" element={<PrivateRoute component={Categories} />} />
<Route path="categories/:reportingCategoryId" element={<PrivateRoute component={CommentariesList} />} />
<Route path="commentaries/new" element={<PrivateRoute component={CommentaryNew} />} />
<Route path="commentaries/:commentaryId" element={<PrivateRoute component={CommentaryEdit} />} />
<Route path="slider" element={<PrivateRoute component={Slider} />} />
<Route path="uwec" element={<PrivateRoute component={WeeklyCalendar} />} />
<Route path="return-expectations-chart" element={<PrivateRoute component={ReturnExpectationsChart} />} />
</Route>
</Route>
<Route path="*" element={<RedirectToApp />} />
</Routes>
Healthcheck component:
import { Navigate } from 'react-router'
const HealthCheck = () => <Navigate to={process.env.PUBLIC_URL + '/healthcheck.html'} />
export default HealthCheck
And the healtcheck.html in my public folder that simply returns harcoded text:
status:200
All seems fine with these structure but the problem is I need to access the healthcheck url like this myurl.com/healthcheck.html
Unless I append the html extension at the end that's the only way I can access the page. If I modify my path in my routes to like this one, without the .html extension, then I get 404 not found.
<Route path="health-check" element={<HealthCheck />} /> //THIS IS MY HEALTHCHECK PAGE
As much as possible I'd like my path to be just /healthcheck, without the html extension. By the way I made use of plain html file in the public folder so that my healthcheck page will not use bootstrap style. Thanks of any help.