Skip to content

Blank Page on Refresh of Non-Homepage Routes #2326

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sayem314 opened this issue May 22, 2025 · 3 comments
Open

Blank Page on Refresh of Non-Homepage Routes #2326

sayem314 opened this issue May 22, 2025 · 3 comments
Assignees
Labels
good first issue Good for newcomers
Milestone

Comments

@sayem314
Copy link

When deploying Checkmate using the docker compose (where the React frontend is served by the backend server), navigating to any non-homepage route (e.g., /uptime) works correctly initially. However, if the page is refreshed (e.g., Cmd+R or F5), the browser displays a blank page. Navigating back to the root (/) resolves the issue, and the application loads again. This indicates a client-side routing issue where the server is not falling back to serving index.html for direct requests to sub-routes.

Steps to Reproduce:

  • Deploy Checkmate using the docker-compose.yml template from https://kvmpods.com/app-templates/checkmate.
  • Configure UPTIME_APP_API_BASE_URL, UPTIME_APP_CLIENT_HOST, CLIENT_HOST, and JWT_SECRET appropriately (either hardcoded or via .env file as per the template).
  • Start the application: docker compose up -d
  • Open the application in a web browser (e.g., http://localhost:300).

Navigate to a non-homepage route within the application (e.g., http://localhost:300/uptime). The page loads correctly.

Perform a hard refresh on the browser (e.g., Cmd+R on Mac, F5 on Windows/Linux).

Expected Behavior:

The application should reload the current page (http://localhost:300/uptime) successfully, serving the index.html and allowing the client-side router to handle the route.

Actual Behavior:

The browser displays a blank page. No content is loaded.

Impact:

Users are unable to directly refresh specific pages or bookmark non-homepage routes, as direct access to these URLs fails.

@gorkem-bwl gorkem-bwl added this to the 3.0 milestone May 22, 2025
@gorkem-bwl gorkem-bwl added the good first issue Good for newcomers label May 22, 2025
@gorkem-bwl
Copy link
Contributor

Thanks @sayem314 for this issue! We'll have a look at it, or a contributor can grab it :)

@karins28
Copy link

karins28 commented May 26, 2025

I’m wondering if this might be related to how static files are served — since the backend is responsible for serving the frontend. Could it be that when you refresh on a non-homepage route, the network shows a GET request to that path, but responds with a 404 Not Found?

It seems like on the homepage, the server correctly returns index.html, but for any other route (like /uptime), it tries to resolve that path as a file and doesn't find it — so it returns a 404.

In that case I think the right approach be to update the backend so that it catches client-side routes and returns index.html in those cases, what are your thoughts?

@sayem314
Copy link
Author

Rewrite rules should fix

@gorkem-bwl gorkem-bwl modified the milestones: 3.0, 2.2 May 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants