<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Map :: NJET文档</title>
    <link>https://docs.njet.org.cn/docs/v4.0.1/reference/http/map/index.html</link>
    <description></description>
    <generator>Hugo</generator>
    <language>zh</language>
    <lastBuildDate>Thu, 14 Aug 2025 11:52:22 +0800</lastBuildDate>
    <atom:link href="https://docs.njet.org.cn/docs/v4.0.1/reference/http/map/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>静态配置map</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/http/map/static/index.html</link>
      <pubDate>Thu, 14 Aug 2025 11:52:17 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/http/map/static/index.html</guid>
      <description>1.功能描述 Njet 配置文件中可以通过Map 指令，检测已有的变量，根据匹配到的值，映射到自定义变量，并对自定义变量赋值。&#xA;2.依赖模块 njet.conf&#xA;load_module modules/njt_http_dyn_map_module.so; 3.配置说明 该动态模块，使用 api/v1/config api 接口进行动态值的修改，因此需要配置 helper ctl 模块， helper broker 模块， 数据面中需要加载 njt_http_dyn_map_module.so&#xA;njet.conf 中需要包含：&#xA;load_module modules/njt_http_dyn_map_module.so; #map模块必须加载该so helper ctrl modules/njt_helper_ctrl_module.so njet_ctrl.conf; helper broker modules/njt_helper_broker_module.so; http { include mime.types; map $arg_a $testv { default 00; aa 11; bb 22; cc 33; dd 44; } server { server_name loaclhost; listen 8080; location / { return 200 &#34;map test,mapped value is ${testv} \n&#34;; } } } njet_ctrl.conf 配置：</description>
    </item>
    <item>
      <title>动态配置Map</title>
      <link>https://docs.njet.org.cn/docs/v4.0.1/reference/http/map/dyn/index.html</link>
      <pubDate>Thu, 14 Aug 2025 11:52:22 +0800</pubDate>
      <guid>https://docs.njet.org.cn/docs/v4.0.1/reference/http/map/dyn/index.html</guid>
      <description>1.功能描述 该动态模块可以对已经配置的Map映射规则进行更改和动态添加新的http map.&#xA;2.依赖模块 njet.conf&#xA;load_module modules/njt_http_dyn_map_module.so; 3.API 3.1 API 列表 查询接口：&#xA;GET http://IP+port/api/v1/config/http_dyn_map 修改接口：&#xA;PUT http://IP+port//api/v1/config/http_dyn_map 动态添加新的http map&#xA;api 新增type 字段，有效值：&#xA;del： 删除map。同时判断keyFrom,keyTo 是否相同。静态文件配置的不允许删除。&#xA;add：添加新的map。添加时判断是否存在，存在时更新。不存在则添加。存在的判断条件：keyTo是否存在。 其他值：走更新流程。 同时判断keyFrom,keyTo 是否相同。&#xA;3.2 调用样例 查询 map curl -X &#39;GET&#39; &#39;http://127.0.0.1:8081/api/v1/config/http_dyn_map&#39; |jq 修改map 添加:&#xA;curl -X &#39;PUT&#39; &#39;http://127.0.0.1:8081/api/v1/config/http_dyn_map&#39; -H &#39;accept: application/json&#39; -H &#39;Content-Type: application/json&#39; -d &#39;{ &#34;maps&#34;: [ { &#34;keyFrom&#34;: &#34;$host&#34;, &#34;keyTo&#34;: &#34;$zzz&#34;, &#34;type&#34;: &#34;add&#34;, &#34;values&#34;: [ { &#34;valueFrom&#34;: &#34;/www1&#34;, &#34;valueTo&#34;: &#34;g12&#34; }, { &#34;valueFrom&#34;: &#34;/www2&#34;, &#34;valueTo&#34;: &#34;g2&#34; } ], &#34;isVolatile&#34;: true, &#34;hostnames&#34;: false } ] }&#39; 返回：</description>
    </item>
  </channel>
</rss>