GithubHelp home page GithubHelp logo

eagleusb / ngx_http_proxy_connect_module Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chobits/ngx_http_proxy_connect_module

0.0 1.0 0.0 14 KB

A forward proxy module for CONNECT request handling

License: BSD 2-Clause "Simplified" License

C 91.90% Perl 8.10%

ngx_http_proxy_connect_module's Introduction

ngx_http_proxy_connect_module

This module provides support for the "CONNECT" HTTP method.
This method is mainly used to tunnel SSL requests through proxy servers.

Example

 server {
     listen                         3128;

     # dns resolver used by forward proxying
     resolver                       8.8.8.8;

     # forward proxy for CONNECT request
     proxy_connect;
     proxy_connect_allow            443 563;
     proxy_connect_connect_timeout  10s;
     proxy_connect_read_timeout     10s;
     proxy_connect_send_timeout     10s;

     # forward proxy for non-CONNECT request
     location / {
         proxy_pass http://$host;
         proxy_set_header Host $host;
     }
 }

With above configuration, you can get any https website via HTTP CONNECT tunnel. A simple test with command curl is as following:

$ curl https://github.com/ -v -x 127.0.0.1:3128

...

Also you can configure your browser to use this nginx as PROXY server.

Directive

proxy_connect

Syntax: proxy_connect
Default: none
Context: server

Enable "CONNECT" HTTP method support.

proxy_connect_allow

Syntax: proxy_connect_allow [port ...]
Default: 443 563
Context: server

This directive specifies a list of port numbers or ranges to which the proxy CONNECT method may connect.
By default, only the default https port (443) and the default snews port (563) are enabled.
Using this directive will override this default and allow connections to the listed ports only.

proxy_connect_connect_timeout

Syntax: proxy_connect_connect_timeout time
Default: none
Context: server

Defines a timeout for establishing a connection with a proxied server.

proxy_connect_read_timeout

Syntax: proxy_connect_read_timeout time
Default: 60s
Context: server

Defines a timeout for reading a response from the proxied server.
The timeout is set only between two successive read operations, not for the transmission of the whole response.
If the proxied server does not transmit anything within this time, the connection is closed.

proxy_connect_write_timeout

Syntax: proxy_connect_write_timeout time Default: 60s Context: server

Sets a timeout for transmitting a request to the proxied server.
The timeout is set only between two successive write operations, not for the transmission of the whole request.
If the proxied server does not receive anything within this time, the connection is closed.

Nginx Compatibility

The latest module is compatible with the following versions of nginx:

  • 1.9.2 (stable version of 1.9.x)
  • 1.8.1 (stable version of 1.8.x)
  • 1.6.3 (stable version of 1.6.x)
  • 1.4.7 (stable version of 1.4.x)

Tengine Compatibility

This module will be merged into tengine soon, see this pull request.

Install

Install this module from source:

$ wget http://nginx.org/download/nginx-1.9.2.tar.gz
$ tar -xzvf nginx-1.9.2.tar.gz
$ cd nginx-1.9.2/
$ patch -p1 < /path/to/ngx_http_proxy_connect_module/proxy_connect.patch
$ ./configure --add-module=/path/to/ngx_http_proxy_connect_module
$ make && make install

Note that proxy_connect.patch includes logic in macro NGX_HTTP_RPOXY_CONNECT, and config script will enable this macro automatically.

Author

This module was developed by Peng Qi originally.
He contributed this module to Tengine in this pull request.

I build this module for Nginx proper based on his pull request.

ngx_http_proxy_connect_module's People

Contributors

chobits avatar

Watchers

Leslie-Alexandre DENIS avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.