<commit_before># Connect-Proxy
Connect-Proxy is a middleware layer for [connect](https://github.com/senchalabs/connect) that retrieves originating IP/Host values when proxying to your connect app.

## Purpose
When proxying to node (often done because of host/port restrictions, albeit the shortcomings of this approach), the IP address at `req.socket.remoteAddress` is the IP of the proxy server and `req.headers.host` is the internal hostname:port of the node server, e.g. localhost:3000.

This middleware allows you to use your connect-based app regardless of your node installation being proxied to. It also helps you utilize features of connect that depend on the described header values and would otherwise lead to unexpected results:

   - Logging `:remote-addr`: When logging with connects logger middleware, the address logged is no longer the address of the proxy, but the address of the user
   - Redirecting to `'/'`:
.

It does so by replacing properties of the req object with values taken from special headers containing the originating IP address and the host name that was originally accessed. Most proxies send these kind of headers, usually `x-forwarded-for` and `x-forwarded-host` . These headers can be comma separated lists in case of multiple proxies, with the left-most being the originating value.

Docs: [apache](http://httpd.apache.org/docs/2.3/mod/mod_proxy.html#x-headers), [nginx](http://wiki.nginx.org/HttpProxyModule), [squid](http://www.squid-cache.org/Doc/config/forwarded_for/)

## Install

`npm install connect-proxy`

## Usage

Require the module:

    var proxy = require('connect-proxy');

Use the middleware by calling `realValues` with an options object:

    app.configure(function() {
      app.use(proxy.realValues({
        trusted: '127.0.0.1'
      }));
    }

## Options

   - `trusted` description
   - `strict`
   - `ipHeader`
   - `hostHeader`

## Connect Compatibility
Works with Connect@1.3.0

If someone finds out more, drop me a line.

## License
View the [LICENSE](https://github.com/gonsfx/connect-proxy/blob/master/LICENSE) file.<commit_msg>Edited Readme.md via GitHub<commit_after># Connect-Proxy
Connect-Proxy is a middleware layer for [connect](https://github.com/senchalabs/connect) that retrieves originating IP/Host values when proxying to your connect app.

## Purpose
When proxying to node (often done because of host/port restrictions, albeit the shortcomings of this approach), the IP address at `req.socket.remoteAddress` is the IP of the proxy server and `req.headers.host` is the internal hostname:port of the node server, e.g. localhost:3000.

This middleware allows you to use your connect-based app regardless of your node installation being proxied to. It also helps you utilize features of connect that depend on the described header values and would otherwise lead to unexpected results:

   - Logging `:remote-addr`: The address logged by using the `:remote-addr`-Token of connects logger middleware is no longer the address of the proxy, but the address of the user
   - Redirecting to `'/'`:
.

It does so by replacing properties of the req object with values taken from special headers containing the originating IP address and the host name that was originally accessed. Most proxies send these kind of headers, usually `x-forwarded-for` and `x-forwarded-host` . These headers can be comma separated lists in case of multiple proxies, with the left-most being the originating value.

Docs: [apache](http://httpd.apache.org/docs/2.3/mod/mod_proxy.html#x-headers), [nginx](http://wiki.nginx.org/HttpProxyModule), [squid](http://www.squid-cache.org/Doc/config/forwarded_for/)

## Install

`npm install connect-proxy`

## Usage

Require the module:

    var proxy = require('connect-proxy');

Use the middleware by calling `realValues` with an options object:

    app.configure(function() {
      app.use(proxy.realValues({
        trusted: '127.0.0.1'
      }));
    }

## Options

   - `trusted` description
   - `strict`
   - `ipHeader`
   - `hostHeader`

## Connect Compatibility
Works with Connect@1.3.0

If someone finds out more, drop me a line.

## License
View the [LICENSE](https://github.com/gonsfx/connect-proxy/blob/master/LICENSE) file.
{'fraction_non_alphanumeric': 0.09247871333964049, 'fraction_numerical': 0.007095553453169348, 'mean_word_length': 4.138517618469016, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1106332', 'n_tokens_mistral': 1218, 'n_tokens_neox': 1154, 'n_words': 484}