• 请不要在回答技术问题时复制粘贴 AI 生成的内容
daijinming
V2EX  ›  程序员

请教一个 nginx 根据 HTTP 请求头信息条件转发的问题

  •  
  •   daijinming · Aug 12, 2022 · 2358 views
    This topic created in 1546 days ago, the information mentioned may be changed or developed.
    需求是这样的,一个 HTTP API 请求,如果来源是一个特定的 IP(读取 Referer),不仅要正常返回结果,还需要将这个请求转发给另外一个 API 地址,无需等待返回,请教下大家
    5 replies  •  2022-08-12 22:39:13 +08:00
    porr
    porr
    Aug 12, 2022
    1
    用 openresty 加上 lua 应该可以,当然我没有试过具体操作。
    xuelu520
    xuelu520
    Aug 12, 2022
    2
    nginx Lua 将结果写到消息队列去.
    然后队列那边消费。消费那边转发请求另外那个 api
    neighbads
    neighbads
    Aug 12, 2022
    3
    自己写一个处理 subrequest 的模块应该能搞
    momocraft
    momocraft
    Aug 12, 2022
    4
    traffic mirroring ?

    我记得可以无条件 mirror 到 internal location ,然后在 internal location 判断
    xzl
    xzl
    Aug 12, 2022
    5
    kong
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5888 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 54ms · UTC 03:12 · PVG 11:12 · LAX 19:12 · JFK 22:12
    ♥ Do have faith in what you're doing.