<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>http配置 :: NJET文档</title>
    <link>https://docs.njet.org.cn/docs/v4.0.1/reference/http/index.html</link>
    <description></description>
    <generator>Hugo</generator>
    <language>zh</language>
    <lastBuildDate>Wed, 20 Aug 2025 16:41:22 +0800</lastBuildDate>
    <atom:link href="https://docs.njet.org.cn/docs/v4.0.1/reference/http/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Accesslog</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/http/accesslog/index.html</link>
      <pubDate>Fri, 15 Aug 2025 15:14:24 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/http/accesslog/index.html</guid>
      <description></description>
    </item>
    <item>
      <title>缓存功能</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/http/cache/index.html</link>
      <pubDate>Thu, 14 Aug 2025 14:58:33 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/http/cache/index.html</guid>
      <description>1. 功能描述 NJET会缓存来自代理 Web 或应用程序服务器的静态和动态内容，以加快向客户端的响应速度并减少上游服务器上的负载。启用缓存后，NjET将响应保存在NjET磁盘缓存中，并使用它们来响应客户端，而不必每次都对相同内容向上游服务器发起请请求。&#xA;2.使用介绍 2.1启用缓存 若要启用缓存，请在Http上下文中包含 proxy_cache_path指令。第一个参数是缓存内容的本地文件系统路径，第二个参数定义用于存储有关缓存项的元数据的共享内存区域的名称和大小。&#xA;http { # ... proxy_cache_path /data/njet/cache keys_zone=mycache:10m; } 然后在要缓存server响应的上下文（http、server或location）中包含proxy_cache指令，并指定由上述指令参数定义的共享内存区域名称。&#xA;http { # ... proxy_cache_path /data/njet/cache keys_zone=mycache:10m; server { proxy_cache mycache; location / { proxy_pass http://localhost:8000; } } } 请注意，参数定义的大小不会限制缓存响应数据的总量。缓存的响应本身与元数据的副本一起存储在文件系统上的特定文件中。要限制缓存的响应数据量，请将参数max_size 配置在 proxy_cache_path指令中。（但请注意，缓存的数据量可能会暂时超过此限制)。&#xA;2.2指定要缓存的请求 默认情况下，NJET会在第一次从代理服务器收到此类响应时缓存对使用HTTP GET和HEAD方法发出的请求的所有响应。NJET使用请求字符串作为请求的标识符。如果请求与缓存的响应具有相同的键，NJET会将缓存的响应发送到客户端。您可以在 http{} 、server{} 或location{}中包含各种指令，以控制缓存哪些响应。&#xA;要更改用于计算缓存文件标识，请使用proxy_cache_key指令。&#xA;proxy_cache_key &#34;$host$request_uri$cookie_user&#34;; 要定义在缓存响应之前必须发出具有相同键的请求的最小次数，请使用 proxy_cache_min_uses指令：&#xA;proxy_cache_min_uses 5; 要使用 GET和 HEAD以外的方法缓存对请求的响应，请使用 proxy_cache_methods指令并配置要缓存的方法。&#xA;proxy_cache_methods GET HEAD POST; 2.3 限制或禁用缓存 默认情况下，响应无限期地保留在缓存中。仅当缓存超过最大配置大小时，才会删除它们，然后按自上次请求它们以来的时间排序最长最少使用的缓存进行删除。您可以通过在http{} 、server{} 或location{}上下文中包含指令来设置缓存响应被视为有效的时间和是否使用缓存：&#xA;要限制具有特定状态代码的缓存响应被视为有效的时间，请使用 proxy_cache_valid 指令：&#xA;proxy_cache_valid 200 302 10m; proxy_cache_valid 404 1m; 在此示例中，包含代码200或302的响应被视为有效 10 分钟，包含代码的响应的有效期为 1 分钟。要定义具有所有状态代码的响应的有效期，请指定为第一个参数为any：</description>
    </item>
    <item>
      <title>SSL</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/http/ssl/index.html</link>
      <pubDate>Thu, 14 Aug 2025 09:45:33 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/http/ssl/index.html</guid>
      <description>SSL相关功能</description>
    </item>
    <item>
      <title>Vts</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/http/vts/index.html</link>
      <pubDate>Wed, 13 Aug 2025 16:49:09 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/http/vts/index.html</guid>
      <description></description>
    </item>
    <item>
      <title>故障注入功能</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/http/faultinject/index.html</link>
      <pubDate>Fri, 15 Aug 2025 15:11:55 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/http/faultinject/index.html</guid>
      <description></description>
    </item>
    <item>
      <title>配额限制功能</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/http/limit/index.html</link>
      <pubDate>Thu, 14 Aug 2025 17:33:19 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/http/limit/index.html</guid>
      <description>1.功能说明 NJET限流功能包含limit_conn,limit_req和limit_rate3个部分，基本使用和nginx相同。</description>
    </item>
    <item>
      <title>Telemetry 功能</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/http/telemetry/index.html</link>
      <pubDate>Fri, 15 Aug 2025 17:43:10 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/http/telemetry/index.html</guid>
      <description></description>
    </item>
    <item>
      <title>比例分流</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/http/split_client/index.html</link>
      <pubDate>Mon, 18 Aug 2025 10:15:06 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/http/split_client/index.html</guid>
      <description></description>
    </item>
    <item>
      <title>Kv 缓存</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/http/key_value/index.html</link>
      <pubDate>Mon, 18 Aug 2025 10:37:52 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/http/key_value/index.html</guid>
      <description>1.功能描述 控制面的Sendmsg模块提供了可选的配置指令dyn_sendmsg_kv， 这个指令将对外提供KV 值设置及查询的 HTTP API 接口。&#xA;2.API 通过在控制面的配置文件中，添加一个location, 并在location 中使用dyn_sendmsg_kv指令开启KV HTTP API。以下的配置示例中的端口及URL 可以根据需要进行更改。&#xA;server { listen 8081; location /api { dyn_module_api; } } 2.1 API 说明 通过配置的location 的url，使用POST方法，设置key value 值， 提交的报文为JSON格式。&#xA;以下请求请注意替换IP 、端口 、URL，与实际的配置需要一致&#xA;设置KV值&#xA;请求：&#xA;POST http://127.0.0.1:8081/api/v1/kv Content-Type: application/json { &#34;key&#34;:&#34;sc_test_key&#34;, &#34;value&#34;:&#34;here is the test msg&#34; } 返回：&#xA;HTTP/1.1 200 OK Server: njet/1.23.1 Date: Tue, 07 Mar 2023 08:10:20 GMT Content-Length: 0 Connection: keep-alive 查询key value 值&#xA;请求：</description>
    </item>
    <item>
      <title>正向代理</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/http/forward_proxy/index.html</link>
      <pubDate>Tue, 19 Aug 2025 11:42:16 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/http/forward_proxy/index.html</guid>
      <description>1.正向代理 配置在客户端，客户端所有流量都通过正向代理去访问&#xA;2.指令介绍 proxy_connect Syntax: proxy_connect Default: none Context: server&#xA;启用“ CONNECT”HTTP 方法支持。&#xA;proxy_connect_allow Syntax: proxy_connect_allow all | [port …] | [port-range …]&#xA;Default: 443 563&#xA;Context: server&#xA;此指令指定代理 CONNECT 方法可以连接到的端口号或范围的列表。 默认情况下，只启用默认的 https 端口(443)和默认的 snews 端口(563)。 使用此指令将覆盖此默认值，并仅允许连接到列出的端口。&#xA;All 值将允许所有端口进行代理。&#xA;给定值将允许指定的端口代理。&#xA;port-range 将允许指定的端口到代理的范围，例如:&#xA;proxy_connect_allow 1000-2000 3000-4000; # allow range of port from 1000 to 2000, from 3000 to 4000. proxy_connect_connect_timeout Syntax: proxy_connect_connect_timeout time&#xA;Default: none&#xA;Context: server&#xA;定义与代理服务器建立连接的超时。&#xA;3.配置示例 Example&#xA;server { listen 80; //端口设定 resolver 114.114.114.114; # dns解析服务器 proxy_connect; proxy_connect_allow 443, 456; proxy_connect_connect_timeout 10s; location /{ proxy_pass $scheme://$host$request_uri; #proxy_pass 用来要代理的网站， } } } 客户端配置（win10系统为例）</description>
    </item>
    <item>
      <title>动态黑白名单配置</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/http/dyn_black/index.html</link>
      <pubDate>Mon, 18 Aug 2025 10:43:19 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/http/dyn_black/index.html</guid>
      <description>1.依赖模块 数据面需要加载如下模块&#xA;load_module modules/njt_http_dyn_bwlist_module.so; 2.指令说明 动态配置无特殊的指令， 动态黑白名单的配置指令及格式与静态配置一致，使用 allow, deny 指定允许或拒绝的IP地址。&#xA;语法: allow address | CIDR | all；&#xA;默认值: –&#xA;允许配置位置: http, server, location&#xA;语法: deny address | CIDR | all；&#xA;默认值: –&#xA;允许配置位置: http, server, location&#xA;3.配置示例 worker_processes 1; error_log logs/error.log info; load_module modules/njt_http_dyn_bwlist_module.so; helper broker modules/njt_helper_broker_module.so conf/mqtt.conf; helper broker modules/njt_helper_ctrl_module.so conf/njet_ctrl.conf; events { worker_connections 1024; } upstream backend { server 10.10.12.1:8080; } http{ dyn_kv_conf conf/iot.conf; server { listen 18888; location / { proxy_pass http://${backend}; } location /test_bwlist { allow 192.168.1.0/24; deny all; proxy_pass http://${backend}; } } } cluster_name helper; node_name node1; 4.API 4.1 API 列表 查询接口</description>
    </item>
    <item>
      <title>api接口ACL控制</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/http/acl/index.html</link>
      <pubDate>Thu, 14 Aug 2025 14:13:39 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/http/acl/index.html</guid>
      <description></description>
    </item>
    <item>
      <title>人机验证</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/http/captcha/index.html</link>
      <pubDate>Wed, 20 Aug 2025 16:41:22 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/http/captcha/index.html</guid>
      <description>1. 功能描述 人机验证功能是为了当某个location 被恶意的频繁访问时，可以根据配置，对访问频率超过一定次数的client_ip,动态的弹出认证页面。&#xA;2. 依赖模块 人机验证功能依赖模块：&#xA;load_module modules/njt_http_captcha_module.so; 3. 指令说明 Syntax: captcha Default: 开启captcha 功能。 Context: location Syntax: captcha_zone Default: captcha_zone 设置共享内存。 例如：captcha_zone $binary_remote_addr zone=captcha_zone:10m; Context: http， server，location Syntax: captcha_limit_rate Default: 设置每秒请求最大值。超过后弹出captcha 页面。 captcha_zone 为使用的，共享内存。 例如：captcha_limit_rate captcha_zone 1; Context: http， server，location Syntax: captcha_expire Default: 设置超时时间。 Context: http， server，location Syntax: captcha_secret Default: 生成cookie 的密钥。 Context: http， server，location Syntax: captcha_redirect_uri_file Default: captcha 页面模板 Context: http， server，location Syntax: captcha_session_zone Default: captcha session zone 设置。 captcha_session_zone session_zone 10m; Context: http， server，location 4. 配置说明 helper broker modules/njt_helper_broker_module.so conf/mqtt.conf; helper ctrl modules/njt_helper_ctrl_module.so conf/ctrl.conf; load_module modules/njt_http_captcha_module.so; user root; worker_processes auto; cluster_name helper; node_name node-u01; error_log logs/error.log debug; pid logs/njet.pid; events { worker_connections 1024; } http { dyn_kv_conf conf/iot-work.conf; include mime.types; default_type application/octet-stream; variables_hash_max_size 4096; access_log logs/access.log; upstream backend1 { zone backend1_zone 128k; server 127.0.0.1:8001; } upstream backend2{ zone backend2_zone 128k; server 127.0.0.1:8002; } upstream backend3{ zone backend2_zone 128k; server 127.0.0.1:8003; } captcha_zone $binary_remote_addr zone=captcha_zone:10m; captcha_session_zone session_zone 10m; #captcha_redirect_uri_file html/app.html; server { listen 0.0.0.0:8001; location / { default_type text/html; return 200 &#34;8001 $request_uri&#34;; } } server { listen 0.0.0.0:90; server_name server-90; captcha_secret &#34;abc&#34;; location /upstream { captcha_limit_rate captcha_zone 1; default_type text/html; proxy_pass http://backend1; } location =/captcha { default_type text/html; captcha; } } } 5. 调用样例 5.1 配置并开启Captcha后，多次访问location，触发captcha并输入验证码</description>
    </item>
    <item>
      <title>反向代理</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/http/reverse_proxy/index.html</link>
      <pubDate>Wed, 20 Aug 2025 13:44:44 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/http/reverse_proxy/index.html</guid>
      <description>反向代理相关功能</description>
    </item>
    <item>
      <title>Add_more_header</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/http/add_more_header/index.html</link>
      <pubDate>Fri, 15 Aug 2025 17:34:19 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/http/add_more_header/index.html</guid>
      <description>1 功能说明 可以通过一条指令设定多个header值。&#xA;2 依赖模块 add_more_header功能依赖模块:&#xA;load_module modules/njt_http_multi_header_module.so; 3. 指令说明 Syntax add_more_header name value1 value2 value…. [always] Default - Context http,server,location 参数介绍：&#xA;参数 取值 说明 name Header 名字。例如：Set-Cookie value1 value2…字段值。 例如：“key=$uri” “key2=2” “key3=3” “key4”; 4. 配置说明 njet.conf&#xA;helper broker modules/njt_helper_broker_module.so conf/mqtt.conf; helper ctrl modules/njt_helper_ctrl_module.so conf/ctrl.conf; load_module modules/njt_http_multi_header_module.so; user root; worker_processes 2; cluster_name helper; node_name node-u01; error_log logs/error.log info; pid logs/njet.pid; events { worker_connections 1024; } http { dyn_kv_conf conf/iot-work.conf; include mime.types; default_type application/octet-stream; variables_hash_max_size 4096; access_log logs/access.log; upstream backend1 { zone backend1_zone 128k; server 127.0.0.1:5888; } server { listen 0.0.0.0:5555; server_name localhost; location / { add_more_header Set-Cookie &#34;key=$uri&#34; &#34;key2=2&#34; &#34;key3=3&#34; &#34;key4&#34;; default_type text/html; proxy_pass http://backend1; } } server { listen 0.0.0.0:5888; location / { default_type text/html; return 200 &#34;5888 $request_uri&#34;; } } } 5. 调用样例 发送</description>
    </item>
    <item>
      <title>动态Add_header</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/http/add_header/index.html</link>
      <pubDate>Fri, 15 Aug 2025 17:05:42 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/http/add_header/index.html</guid>
      <description>1. 功能描述 该功能主要将add_header指令动态化，可以通过动态api接口进行配置。&#xA;2. 依赖模块 Add_header功能依赖模块:&#xA;load_module modules/njt_http_dyn_header_module.so; 3. 指令说明 Syntax: add_header key value [always]; Default: — Context: http, server, location, if in location key header名，可配置常量或者变量。&#xA;value 变量值，可包含变量。&#xA;always always为true时忽略返回码。 默认当返回码为200, 201 (1.3.10), 204, 206, 301, 302, 303, 304, 307 (1.1.16, 1.0.13), or 308 才显示需要添加的header。&#xA;配置说明 helper broker modules/njt_helper_broker_module.so conf/mqtt.conf; helper ctrl modules/njt_helper_ctrl_module.so conf/ctrl.conf; load_module modules/njt_http_dyn_header_module.so; user root root; worker_processes 2; cluster_name helper; node_name node1; error_log logs/error.log info; pid logs/njet.pid; events { worker_connections 1024; } http { dyn_kv_conf conf/iot-work.conf; include mime.types; default_type application/octet-stream; default_type text/html; access_log logs/access.log; variables_hash_max_size 2048; sendfile on; keepalive_timeout 65; upstream backend1 { zone backend1 128k; server 127.0.0.1:5889; } server { listen 5555; server_name localhost; set $upstream backend2; set $upstream_name backend1; location / { proxy_pass http://backend1; } location /add_header { proxy_pass http://backend1?test=$host/; } location ($uri = /test_header) { proxy_pass http://backend1; } } } server { listen 5889; return 200 &#34;8001 $request_uri&#34;; } } 4. 调用样例 4.1 API说明 查询接口：</description>
    </item>
    <item>
      <title>动态VS</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/http/dyn_vs/index.html</link>
      <pubDate>Fri, 15 Aug 2025 11:40:09 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/http/dyn_vs/index.html</guid>
      <description>动态VS功能，提供了动态添加、删除server块的能力，并且支持在添加时配置NJet指令。&#xA;目前动态VS功能可以对静态配置中已经监听的端口和未监听的端口添加VS。&#xA;动态vs: 介绍对静态配置中已经监听的端口添加或者删除VS。&#xA;动态添加新端口的VS: 介绍对静态配置中未监听的端口添加或者删除VS。</description>
    </item>
    <item>
      <title>Map</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/http/map/index.html</link>
      <pubDate>Thu, 14 Aug 2025 11:52:06 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/http/map/index.html</guid>
      <description></description>
    </item>
    <item>
      <title>动态location</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/http/dynamic_loccation/index.html</link>
      <pubDate>Wed, 13 Aug 2025 16:02:46 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/http/dynamic_loccation/index.html</guid>
      <description>1.功能说明 本系统支持对配置的server中的location进行动态的添加、删除，可以对locaiton进行便捷的配置和所需指令功能的添加使用。&#xA;2.依赖模块 动态location功能依赖:&#xA;njet.conf&#xA;load_module modules/njt_http_location_module.so; njet_ctrl.conf&#xA;load_module modules/njt_http_location_api_module.so; 3.配置说明 使用动态location功能需要在njet.conf中配置&#xA;load_module modules/njt_http_location_module.so; 在njet_ctrl.conf中配置&#xA;load_module modules/njt_http_sendmsg_module.so; load_module modules/njt_http_location_api_module.so; http { server { listen 8081; location /api { dyn_module_api; } } } 4.API说明 添加接口：&#xA;POST http://IP+port/api/v1/dyn_loc 删除接口：&#xA;PUT http://IP+port/api/v1/dyn_loc 动态location增加说明：&#xA;配置项 必填 配置说明 type 是 “add” 添加location addr_port 是 添加的主机的，port 端口。 例如：“192.168.40.203:8000”， 或 “0.0.0.0:8000” server_name 是 主机的server_name, 例如：“cluster.tmlake.com” locations 是 List 对象列表。 对象字段：location_rule，//可以为空。 location_name， //不能为空。location_body， 结尾不要带，暂时不支持if指令和包含zone的指令;proxy_pass 结尾不要带; 特别说明：</description>
    </item>
  </channel>
</rss>