# express-vhost

> Scalable vhost middleware for express.

Latest version **0.2.0** (published 2015-02-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install express-vhost
pnpm add express-vhost
yarn add express-vhost
bun add express-vhost
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2015-02-27 |
| First published | 2012-10-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.8.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Tommy Messbauer |
| Maintainers | tommydudebreaux |
| Keywords | node, vhost, middleware, connect, express |

## Links

- npm: https://www.npmjs.com/package/express-vhost
- Repository: git@github.com:tommymessbauer/express-vhost
- Homepage: https://github.com/tommymessbauer/express-vhost
- Issues: https://github.com/tommymessbauer/express-vhost/issues
- npm.io page: https://npm.io/package/express-vhost

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2015-02-27
- 0.1.2 — 2015-01-06
- 0.1.1 — 2013-08-27
- 0.1.0 — 2012-10-16

## README

# express-vhost

Improves on express.js middleware for vhost by avoiding expensive regex chains.  This will perform better and scale more than connect vhost.

If trust proxy is enabled the X-Forwarded-Host header will be respected, so that the hosts can work behind a remote proxy such as Nginx.


``` javascript

var evh = require('express-vhost'),
	express = require('express');

var appFactory = function(echo) {
	var app = express();
	app.get('/', function(req, res) {
		res.send(echo);
	});

	return app;
};

var server = express();
server.use(evh.vhost(server.enabled('trust proxy')));
server.listen(port);

evh.register('test1-local', appFactory('test1'));
var app2 = appFactory('test2');
evh.register('test2-local', app2);
evh.register('*.test2-local', appFactory('test2'));

```

---
_Source: https://npm.io/package/express-vhost · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
