nginx/src/http/modules
Roman Arutyunyan d76e3d3016 HTTP CONNECT proxy.
HTTP CONNECT method is now supported in HTTP/1 connections.  It's disabled
in all currently existing standard modules.  A new variable $port is added
that contains the port passed by client in HTTP CONNECT.  The $host
variable contains the host part.

A new module ngx_http_tunnel module is added which establishes a tunnel
to a backend.  It supports the newly added HTTP CONNECT method and can be
used to set up an HTTP CONNECT proxy.

As recommended by RFC 9110, proxy target should be restricted to ensure
safe proxying:

: Proxies that support CONNECT SHOULD restrict its use to a limited set
: of known ports or a configurable list of safe request targets.

Example config:

    server {
        listen 8000;

        resolver dns.example.com;

        map $port $tun_port {
            80             1;
            443            1;
        }

        map $host $tun_host {
            hostnames;

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

        map $tun_port$tun_host $tun {
            11             $host:$port;
        }

        location / {
            tunnel_pass $tun;
        }
    }

Request:

    $ curl -px 127.0.0.1:8000 http://example.com
2025-05-25 22:16:04 +04:00
..
perl Perl: removed unused variables, forgotten in ef6a3a99a81a. 2022-06-14 10:39:58 +04:00
ngx_http_access_module.c Fixed undefined behaviour with IPv4-mapped IPv6 addresses. 2024-03-18 17:14:30 +04:00
ngx_http_addition_filter_module.c Upstream: keep request body file from removal if requested. 2017-07-19 20:38:17 +03:00
ngx_http_auth_basic_module.c All known output headers can be linked lists now. 2022-05-30 21:25:45 +03:00
ngx_http_auth_request_module.c Auth request: multiple WWW-Authenticate headers (ticket #485). 2022-05-30 21:25:54 +03:00
ngx_http_autoindex_module.c Autoindex: fixed possible integer overflow on 32-bit systems. 2018-12-25 12:59:24 +03:00
ngx_http_browser_module.c Variables: macros for null variables. 2017-08-01 14:28:33 +03:00
ngx_http_charset_filter_module.c Charset filter: improved validation of charset_map with utf-8. 2025-04-09 19:37:51 +04:00
ngx_http_chunked_filter_module.c HTTP CONNECT proxy. 2025-05-25 22:16:04 +04:00
ngx_http_dav_module.c All known output headers can be linked lists now. 2022-05-30 21:25:45 +03:00
ngx_http_degradation_module.c Fixed spelling in multiline C comments. 2012-04-03 07:37:31 +00:00
ngx_http_empty_gif_module.c Copyright updated. 2012-01-18 15:07:43 +00:00
ngx_http_fastcgi_module.c HTTP CONNECT proxy. 2025-05-25 22:16:04 +04:00
ngx_http_flv_module.c Fixed "zero size buf" alerts with subrequests. 2023-01-28 05:23:33 +03:00
ngx_http_geo_module.c Fixed undefined behaviour with IPv4-mapped IPv6 addresses. 2024-03-18 17:14:30 +04:00
ngx_http_geoip_module.c Fixed undefined behaviour with IPv4-mapped IPv6 addresses. 2024-03-18 17:14:30 +04:00
ngx_http_grpc_module.c HTTP CONNECT proxy. 2025-05-25 22:16:04 +04:00
ngx_http_gunzip_filter_module.c Optimized chain link usage (ticket #2614). 2024-05-23 19:15:38 +04:00
ngx_http_gzip_filter_module.c Gzip: compatibility with recent zlib-ng 2.2.x versions. 2025-01-09 17:19:24 +04:00
ngx_http_gzip_static_module.c Fixed "zero size buf" alerts with subrequests. 2023-01-28 05:23:33 +03:00
ngx_http_headers_filter_module.c Headers filter: improved memory allocation error handling. 2022-05-30 21:25:57 +03:00
ngx_http_image_filter_module.c Use ngx_calloc_buf() where appropriate. 2017-04-12 22:21:04 +03:00
ngx_http_index_module.c Fixed request finalization in ngx_http_index_handler(). 2019-12-16 15:19:01 +03:00
ngx_http_limit_conn_module.c Limit conn: added shared context. 2019-11-18 19:50:59 +03:00
ngx_http_limit_req_module.c Fixed handling of already closed connections. 2021-03-28 17:45:39 +03:00
ngx_http_log_module.c Access log: support for disabling escaping (ticket #1450). 2018-03-01 11:42:55 +03:00
ngx_http_map_module.c Map: the "volatile" parameter. 2016-12-08 17:51:49 +03:00
ngx_http_memcached_module.c All known output headers can be linked lists now. 2022-05-30 21:25:45 +03:00
ngx_http_mirror_module.c Mirror: "off" paramater of the "mirror" directive. 2017-07-21 19:47:56 +03:00
ngx_http_mp4_module.c Mp4: prevent chunk index underflow. 2024-11-21 16:08:48 +04:00
ngx_http_not_modified_filter_module.c Moved ngx_http_parse_time() to core, renamed accordingly. 2015-06-11 20:42:31 +03:00
ngx_http_proxy_module.c Upstream: fixed passwords support for dynamic certificates. 2025-04-10 17:27:45 +04:00
ngx_http_random_index_module.c Win32: removed NGX_DIR_MASK concept. 2018-12-24 21:07:05 +03:00
ngx_http_range_filter_module.c Range filter: clearing of pre-existing Content-Range headers. 2022-07-15 07:01:44 +03:00
ngx_http_realip_module.c Reworked multi headers to use linked lists. 2022-05-30 21:25:33 +03:00
ngx_http_referer_module.c Overhauled some diagnostic messages akin to 1b05b9bbcebf. 2024-03-22 14:51:14 +04:00
ngx_http_rewrite_module.c Rewrite: fixed "return" directive without response text. 2024-02-26 20:00:28 +00:00
ngx_http_scgi_module.c HTTP CONNECT proxy. 2025-05-25 22:16:04 +04:00
ngx_http_secure_link_module.c Changed complex value slots to use NGX_CONF_UNSET_PTR. 2021-05-06 02:22:03 +03:00
ngx_http_slice_filter_module.c Slice filter: improved memory allocation error handling. 2025-03-10 19:32:07 +03:00
ngx_http_split_clients_module.c Split clients: check length when parsing configuration. 2013-03-21 16:06:53 +00:00
ngx_http_ssi_filter_module.c Optimized chain link usage (ticket #2614). 2024-05-23 19:15:38 +04:00
ngx_http_ssi_filter_module.h SSI: handling of subrequests from other modules (ticket #1263). 2022-11-21 17:01:34 +03:00
ngx_http_ssl_module.c SSL: caching certificates and certificate keys with variables. 2025-01-17 04:37:46 +04:00
ngx_http_ssl_module.h SSL: caching certificates and certificate keys with variables. 2025-01-17 04:37:46 +04:00
ngx_http_static_module.c Fixed "zero size buf" alerts with subrequests. 2023-01-28 05:23:33 +03:00
ngx_http_stub_status_module.c Removed incorrect optimization of HEAD requests. 2021-01-19 20:21:12 +03:00
ngx_http_sub_filter_module.c Optimized chain link usage (ticket #2614). 2024-05-23 19:15:38 +04:00
ngx_http_try_files_module.c Precontent phase. 2017-07-20 15:51:11 +03:00
ngx_http_tunnel_module.c HTTP CONNECT proxy. 2025-05-25 22:16:04 +04:00
ngx_http_upstream_hash_module.c Upstream: re-resolvable servers. 2024-11-07 07:57:42 -08:00
ngx_http_upstream_ip_hash_module.c Upstream: re-resolvable servers. 2024-11-07 07:57:42 -08:00
ngx_http_upstream_keepalive_module.c Changed keepalive_requests default to 1000 (ticket #2155). 2021-04-08 00:16:30 +03:00
ngx_http_upstream_least_conn_module.c Upstream: re-resolvable servers. 2024-11-07 07:57:42 -08:00
ngx_http_upstream_random_module.c Upstream: re-resolvable servers. 2024-11-07 07:57:42 -08:00
ngx_http_upstream_zone_module.c Upstream: copy upstream zone DNS valid time during config reload. 2024-11-07 07:57:42 -08:00
ngx_http_userid_filter_module.c Reworked multi headers to use linked lists. 2022-05-30 21:25:33 +03:00
ngx_http_uwsgi_module.c HTTP CONNECT proxy. 2025-05-25 22:16:04 +04:00
ngx_http_xslt_filter_module.c Xslt: disabled ranges. 2020-07-22 22:16:19 +03:00