Why does the H2 console in Spring Boot show a blank screen after logging in?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
A blank H2 console screen after login in Spring Boot usually points to security headers, path configuration mismatch, or browser-side blocking. The login form can still appear, which makes the issue confusing because connection settings look correct. A structured check of security config, console path, and JDBC URL resolves most cases quickly.
Typical Root Causes
Most blank-screen reports come from one of these:
X-Frame-Optionsor content security settings blocking H2 UI frames- Spring Security rules denying parts of
/h2-consoleresources - Wrong JDBC URL for in-memory database lifecycle
- Context path or reverse proxy rewriting that breaks console asset loading
Open browser developer tools and check network and console errors first. Missing script files or frame-blocked responses usually reveal the real cause.
Minimum Spring Boot Properties
Start with explicit console settings in application.properties:
If you use file-based DB instead of in-memory, switch URL accordingly.
Spring Security Configuration for H2 Console
With Spring Security enabled, allow console endpoints and relax frame rules for local development.
If frame options are not set to same origin, H2 pages may render blank due to blocked frame loading.
In-Memory Database Lifecycle Confusion
In-memory H2 databases vanish when last connection closes unless configured otherwise. If the console connects to a different URL or timing changes, you may see empty state or misleading behavior.
For stable dev sessions, consider:
Use the same URL in application and H2 console login form.
Context Path and Reverse Proxy Checks
If your app uses server.servlet.context-path, the console endpoint changes. For example, with /app context path, console is under /app/h2-console. A mismatch can load form HTML but fail JS and CSS resources.
If behind Nginx or another proxy, confirm forwarding rules do not strip required console paths.
Fast Debug Workflow
Use this sequence:
- Open browser dev tools and inspect failed requests after login.
- Confirm
spring.h2.console.pathand actual URL match. - Verify security rules permit
/h2-console/**and frame same origin. - Compare JDBC URL in app properties and login form.
- Test with a clean browser profile to rule out extensions and cache.
This workflow usually isolates the issue in minutes.
Production Safety Note
H2 console should be disabled outside local development. Keep it behind strict profiles and never expose it publicly.
For production diagnostics, use controlled database tooling and audited access channels.
Common Pitfalls
- Enabling console but forgetting security exceptions for its assets
- Allowing endpoint path but leaving frame policy too strict
- Using a different JDBC URL in form than the application datasource
- Ignoring context-path effects and testing wrong console URL
- Leaving H2 console enabled in shared or production environments
Most blank-screen cases are configuration alignment issues, not H2 bugs.
Summary
- Blank H2 console pages are usually caused by security or path misconfiguration.
- Permit
/h2-console/**, ignore CSRF for it, and set frame same origin. - Keep JDBC URL consistent between app config and console login.
- Validate context path and proxy behavior when assets fail to load.
- Disable H2 console outside development environments.

