# is-http-url

> Validate URLs for sane values

Latest version **2.0.0** (published 2016-07-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install is-http-url
pnpm add is-http-url
yarn add is-http-url
bun add is-http-url
```

## Health

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

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2016-07-26 |
| First published | 2016-07-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | separate (@types/is-http-url) |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Emil Bay |
| Maintainers | emilbay, emilbayes |
| Keywords | is, http, url, is-url, validate, valid, host, hostname, domain, same-origin, referer, referrer |

## Links

- npm: https://www.npmjs.com/package/is-http-url
- Repository: https://github.com/emilbayes/is-http-url
- Homepage: https://github.com/emilbayes/is-http-url#readme
- Issues: https://github.com/emilbayes/is-http-url/issues
- npm.io page: https://npm.io/package/is-http-url

## Dependencies (1)

- [is-domain-name](https://npm.io/package/is-domain-name.md) ^1.0.0

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2016-07-26
- 1.0.1 — 2016-07-25
- 1.0.0 — 2016-07-25

## README

# `is-http-url`

> Validate URLs for sane values

## Install

```sh
npm install is-http-url
```

## Usage

Does the following:

* Protocol should be one of `http:` or `https:`
* Hostname should be valid [domain name](http://github.com/emilbayes/is-domain-name) or IPv4 address (TODO: IPv6)
* Port, if given, should be an integer in the range [1, 65535]

Example usage could be to validate the `Origin` or `Referer` HTTP headers

```js
const assert = require('assert')
const isHttpUrl = require('is-http-url')

assert.ok(isHttpUrl('http://example.com/hello-world.txt'))
assert.notOk(isHttpUrl('//test'))

```

## API

### isHttpUrl(url)
#### url

Type: `String`

## Related

* [`is-domain-name`](http://github.com/emilbayes/is-domain-name)

## License

[ISC](LICENSE.md)

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