How to Use chrome://net-internals/#hsts to Clear Localhost Cache in Chrome
When developing and testing web applications, cached data on localhost can often interfere with updates, especially when dealing with HTTPS protocols. Chrome provides a powerful built-in tool, chrome://net-internals/#hsts, to manage cached data related to HTTP Strict Transport Security (HSTS). Here's a step-by-step guide to help you clear localhost cache using this tool.
What is HSTS and Why Clear It?
HSTS (HTTP Strict Transport Security) is a web security policy mechanism that enforces HTTPS connections to your website. However, during local development, cached HSTS settings can create issues, such as forcing HTTPS when it's not required. Clearing or modifying these settings ensures a smooth development experience.
Steps to Clear Localhost Cache via chrome://net-internals/#hsts
- Open Chrome's HSTS Settings Page
- Open Chrome and navigate to:
- chrome://net-internals/#hsts
- Delete Domain Security Policies
- Scroll down to the section labeled "Delete domain security policies".
- Enter localhost in the text box provided.
- Click "Delete".
- This action removes HSTS settings for the localhost domain, clearing cached security policies.
- Confirm Removal
- To ensure the HSTS cache for localhost is cleared, use the Query HSTS/PKP domain section.
- Enter localhost again and click "Query".
- If no data appears, the cache has been successfully cleared.
Why Use chrome://net-internals/#hsts for Localhost Cache?
- Efficient Troubleshooting: Directly clear problematic cached policies affecting development.
- Avoid HTTPS Redirection Issues: Especially useful when switching between HTTP and HTTPS during testing.
- Developer-Friendly: Chrome's built-in tools eliminate the need for third-party extensions.