当前位置: 首页 > news >正文

【隐语Secreflow】如何配置 Kuscia 对请求进行 Path Rewrit

打开链接即可点亮社区Star,照亮技术的前进之路。

Github 地址:https://github.com/secretflow/kuscia

背景

隐私计算合作机构之间的网络较为复杂,经常存在多层次的网关,网关根据 Path 将请求路由到真正的业务节点。为了给这种组网提供支持,Kuscia 能够对业务请求进行 Path Rewrite,将对应的路由前缀添加到请求 Path。

:::{tip}
网关要求:机构网关处需要进行 Path 前缀卸载。
:::

多机部署配置 Path Rewrite

  • Kuscia 中心化部署参考这里
  • Kuscia 点对点部署参考这里

下面以 Alice 机构访问 Bob、Carol 机构的通信配置作为示例,其中 Nginx 服务器地址为 1.1.1.1,Bob 机构地址为 2.2.2.2,Carol 机构地址为 3.3.3.3。

# alice accesses bob's addresshttp://1.1.1.1/foo# alice accesses carol's addresshttp://1.1.1.1/bar

Nginx 配置示例如下:

http{# Default is HTTP/1, keepalive is only enabled in HTTP/1.1proxy_http_version1.1;proxy_set_header Connection"";proxy_set_header Host$http_host;proxy_pass_request_headers on;access_log /var/log/access.log;# To allow special characters in headersignore_invalid_headers off;# Maximum number of requests through one keep-alive connectionkeepalive_requests1000;keepalive_timeout 20m;client_max_body_size 2m;# To disable bufferingproxy_buffering off;proxy_request_buffering off;upstream bob{server2.2.2.2:11080weight=1max_fails=5fail_timeout=60s;keepalive32;keepalive_timeout 600s;keepalive_requests1000;}upstream carol{server3.3.3.3:21080weight=1max_fails=5fail_timeout=60s;keepalive32;keepalive_timeout 600s;keepalive_requests1000;}# The reverse proxy needs to remove the prefix path before forwardingserver{location /foo/{proxy_read_timeout 10m;proxy_pass https://bob/;}location /bar/{proxy_read_timeout 10m;proxy_pass https://carol/;}}}

使用 KusciaAPI 配置 Path Rewrite

使用 KusciaAPI 要配置一条 Path Rewrite 路由规则,需要设置endpointprefix字段。

下面以机构 Alice 访问机构 Bob 的场景为例,当机构 Bob 网关地址带 Path 时如何调用 KusciaAPI 设置endpointprefix字段。

# Execute the example inside the container# --cert is the certificate used for mutual authentication with the serverexportCTR_CERTS_ROOT=/home/kuscia/var/certscurl-k -X POST'https://localhost:8082/api/v1/route/create'--header"Token:$(cat${CTR_CERTS_ROOT}/token)"--header'Content-Type: application/json'--cert${CTR_CERTS_ROOT}/kusciaapi-server.crt --key${CTR_CERTS_ROOT}/kusciaapi-server.key --cacert${CTR_CERTS_ROOT}/ca.crt -d'{ "authentication_type": "Token", "destination": "bob", "endpoint": { "host": "1.1.1.1", "ports": [ { "port": 80, "protocol": "HTTP", "isTLS": true, # If the gateway is a domain and supports https, set to true, otherwise set to false "path_prefix": "/foo" } ] }, "source": "alice", "token_config": { "token_gen_method": "RSA-GEN" } }'
http://www.cnnetsun.cn/news/64948.html

相关文章:

  • 毕设分享 深度学习遮挡下的人脸识别(源码+论文)
  • Python UV搭配Miniconda:下一代包管理体验
  • 实验室装修,怎样做更省心?
  • Redis多数据源配置指南
  • AutoGPT支持ONNX Runtime部署了吗?跨框架兼容测试
  • 零基础小白网络安全入行清单:学技术前,先搞定这6件“小事”
  • 计算机毕业设计springboot小区送货系统 基于SpringBoot的社区末端智能配送平台 面向住宅区的 轻量级电商物流管理系统
  • GitHub组织账号管理Qwen3-32B项目协作开发流程
  • 毕设项目分享 基于大数据的招聘职业爬取与分析可视化
  • vLLM镜像实测:连续批处理让Qwen推理效率翻倍
  • LabVIEW 携手 YOLOv8:全方位视觉处理的奇妙之旅
  • 某雷赛86闭环步进驱动方案-HBS86H整体方案及原理图、PCB、无错无警告代码打包
  • 【从0到1学RabbitMQ】十分钟上手 RabbitMQ:Docker 部署 + Spring Boot 自动化配置全攻略
  • 【论文笔记•(多智能体)】A Knowledge-driven Adaptive Collaboration of LLMs for Enhancing Medical Decision-making
  • 通过SEO推广LobeChat博客内容,带动大模型Token购买转化
  • 【Svelte】重定向页面
  • 基于SpringBoot的日用品仓储管理系统的设计与实现
  • 基于SpringBoot的校园论坛交流系统
  • AutoGPT如何处理模糊目标?自然语言理解边界探讨
  • 清华镜像站推荐:Miniconda下载提速80%的秘密武器
  • update.py update脚本 git一键上传push脚本 - Git自动化推送代码的几种方式及实用脚本
  • 从GitHub获取Qwen3-8B最新镜像并完成本地化部署
  • Ubuntu安装完成后配置PyTorch-GPU的完整流程
  • 购买GPU算力租用Qwen3-14B实例的性价比分析
  • LobeChat前端性能优化建议:减少加载时间提升访问量
  • 学术研究新利器:Qwen3-8B开箱即用镜像发布
  • 使用wget命令从清华源下载PyTorch安装包的脚本示例
  • AutoGPT镜像适用于科研场景吗?高校团队已投入使用
  • GitHub热门项目推荐:基于Qwen3-14B开发的企业级AI助手
  • 从零到网络安全专家:一张全景路线图(2025版)