]> git.kaiwu.me - nginx.git/commit
HTTP tunnel module
authorRoman Arutyunyan <arut@nginx.com>
Thu, 16 Apr 2026 16:48:02 +0000 (20:48 +0400)
committerRoman Arutyunyan <arutyunyan.roman@gmail.com>
Fri, 8 May 2026 05:42:58 +0000 (09:42 +0400)
commit8599df49d682c5e7c3856a82db58c4d439a27d08
tree5342424b90070b9a1374df60164307a30ec185b8
parent8de740f89de4064b451959ed914d283f3dad9d3a
HTTP tunnel module

The module handles CONNECT requests and establishes a tunnel to a
backend.

Example config:

http {

    map $request_port $allow_port {
        80             1;
        443            1;
    }

    map $host $allow_host {
        hostnames;

        example.com    1;
        *.example.org  1;
    }

    server {
        listen 8000;

        resolver dns.example.com;

        if ($allow_port != 1) {
            return 403;
        }

        if ($allow_host != 1) {
            return 403;
        }

        tunnel_pass;
    }
}

Request:

    $ curl -x 127.0.0.1:8000 https://example.com
auto/modules
auto/options
src/http/modules/ngx_http_tunnel_module.c [new file with mode: 0644]
src/http/ngx_http_upstream.c
src/http/ngx_http_upstream.h