# @types/original-url

> TypeScript definitions for original-url

Latest version **1.2.3** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/original-url
pnpm add @types/original-url
yarn add @types/original-url
bun add @types/original-url
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.2.3 |
| Published | 2023-11-07 |
| First published | 2022-10-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51419 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/original-url
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/original-url
- npm.io page: https://npm.io/package/@types/original-url

## Dependencies (1)

- [@types/node](https://npm.io/package/@types/node.md) *

## Recent versions

- 1.2.3 (latest) — 2023-11-07
- 1.2.1 (ts4.3) — 2023-09-03
- 1.2.0 (ts4.1) — 2022-10-31
- 1.2.2 — 2023-10-18

## README

# Installation
> `npm install --save @types/original-url`

# Summary
This package contains type definitions for original-url (https://github.com/watson/original-url#readme).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/original-url.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/original-url/index.d.ts)
````ts
/// <reference types="node" />

import { IncomingMessage } from "http";

export = originalUrl;

/**
 * Reconstruct the original URL used in an HTTP request based on the HTTP
 * request headers.
 *
 * The module takes into account potential URL rewrites made by proxies,
 * load balancers, etc along the way (as long as these append special HTTP
 * headers to the request).
 *
 * Supported HTTP headers:
 *
 * - `Host`
 * - `Forwarded`
 * - `X-Forwarded-Proto`
 * - `X-Forwarded-Protocol`
 * - `X-Url-Scheme`
 * - `Front-End-Https`
 * - `X-Forwarded-Ssl`
 * - `X-Forwarded-Host`
 * - `X-Forwarded-Port`
 *
 * If the protocol (http vs https) cannot be determined based on the above
 * headers, the `encrypted` flag on the TLS connection is used.
 *
 * @example
 * import * as http from 'http'
 * import originalUrl = require('original-url')
 *
 * const server = http.createServer((req, res) => {
 *   const url = originalUrl(req)
 *   if (url.full) {
 *     res.end(`Original URL: ${url.full}\n`)
 *   } else {
 *     res.end('Original URL could not be determined\n')
 *   }
 * })
 *
 * server.listen(1337)
 */
declare function originalUrl(req: IncomingMessage): originalUrl.OriginalUrl;

declare namespace originalUrl {
    interface OriginalUrl {
        raw: string | undefined;
        protocol: string;
        hostname: string | undefined;
        port?: number | undefined;
        pathname?: string | undefined;
        search?: string | undefined;
        hash?: string | undefined;
        /** The fully resolved URL. */
        full?: string | undefined;
    }
}

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 09:09:39 GMT
 * Dependencies: [@types/node](https://npmjs.com/package/@types/node)

# Credits
These definitions were written by [BendingBender](https://github.com/BendingBender).

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