{"library":"connect-history-api-fallback","type":"library","category":null,"description":"connect-history-api-fallback is a robust middleware designed for Single Page Applications (SPAs) leveraging the HTML5 History API. It addresses the common challenge where direct access to client-side routes (e.g., `/about` or `/users/123`) or page refreshes result in a 404 \"Not Found\" error from the web server, as these paths do not correspond to physical files. The middleware intercepts such requests, identifies those that accept `text/html` and are not direct file requests (by default, paths containing a dot), and then rewrites the request URL to a specified index file, typically `/index.html`. This allows the SPA's client-side router to take over and render the correct view. The current stable version is 2.0.0. While there isn't a strict release cadence, updates generally address compatibility, performance, or new configuration options. Key differentiators include its configurable `index` path, powerful `rewrites` option supporting both static strings and dynamic functions based on request context, and fine-grained control over accepted HTML headers and dot-file handling. It seamlessly integrates with Connect and Express-based Node.js servers.","language":"javascript","status":"active","version":"2.0.0","tags":["javascript"],"last_verified":"Wed May 27","install":[{"cmd":"npm install connect-history-api-fallback","imports":["import history from 'connect-history-api-fallback';","const history = require('connect-history-api-fallback');","import type { Options } from 'connect-history-api-fallback';"]},{"cmd":"yarn add connect-history-api-fallback","imports":[]},{"cmd":"pnpm add connect-history-api-fallback","imports":[]}],"homepage":null,"github":"https://github.com/bripkens/connect-history-api-fallback","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/connect-history-api-fallback","openapi_spec":null,"status_page":null,"smithery":null,"compatibility":{"summary":{"python_range":"18–22","success_rate":0,"avg_install_s":null,"avg_import_s":null,"wheel_type":null},"url":"https://checklist.day/v1/registry/connect-history-api-fallback/compatibility"}}