# bripkens/connect-history-api-fallback

Fallback to index.html for applications that are using the HTML 5 history API

Repository: https://github.com/bripkens/connect-history-api-fallback
Canonical: https://ross.abutalabs.com/products/connect-history-api-fallback
Language: JavaScript
License: MIT
License Family: permissive
Last push: 2023-10-26T06:55:33+00:00

## Health v2 (maintenance only)
Score: 32/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 4855, "days_push": 1042, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1855, forks 151 (observed 2026-08-28T04:05:44.844798+00:00)

## What it is
A small Node.js middleware for Connect and Express that rewrites requests to an index page (default /index.html) so Single Page Applications using the HTML5 History API don't get 404s on refresh or deep links. It only rewrites GET/HEAD requests that accept text/html and are not direct file requests.

## Use cases
- fix 404 on page refresh in a single page app
- serve index.html for deep links with HTML5 history routing
- add history API fallback middleware to Express
- make React Router or Vue Router routes work on direct access
- configure SPA fallback for a dev server
- rewrite non-file GET requests to index.html

## When to choose
- you host a SPA with client-side routing on a Connect or Express server and hit 404s on refresh or direct URL entry
- you need a tiny, configurable middleware with rewrite rules and custom index paths

## When to avoid
- your server is nginx, Apache, or another static host with its own try_files/rewrite config
- you need server-side rendering or a full static site generator instead of a fallback
- your app is not a SPA using the HTML5 History API

## Facets
- artifact type: library
- maturity: maintenance
- function: middleware, routing, http-server
- domain: web-development, frontend, backend
- platform: -
- tags: spa, html5-history-api, express, connect, fallback, single-page-applications, nodejs, web-server

## Member repositories
- bripkens/connect-history-api-fallback (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:44.844798+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:16:43.816931+00:00, confidence not recorded.
  - readme: https://github.com/bripkens/connect-history-api-fallback (fetched 2026-08-28T04:05:44.844798+00:00, sha 9dbc04369b80)
  - registry_npm: https://registry.npmjs.org/connect-history-api-fallback (fetched 2026-08-29T10:55:42.703838+00:00, sha 9cb0b8be2c86)
- Data as of 2026-08-30T08:39:29.467469+00:00.
