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

求助一个 nginx 的 rewrite 的写法

  •  
  •   sinotw · Jul 22, 2020 · 2323 views
    This topic created in 2145 days ago, the information mentioned may be changed or developed.

    请求的 url: http://ip:port/a/b/c 跳转的 url: http://ip:port/mothed=a&guid=b&entity=c

    大神们指点指点,不胜感激

    5 replies    2020-07-22 21:21:03 +08:00
    march13th
        1
    march13th  
       Jul 22, 2020
    mark 等待用例
    我目前还没出现这种需求过
    GM
        2
    GM  
       Jul 22, 2020   ❤️ 3
    location ~ ^/(?<method>.+)/(?<guid>.*)/(?<entity>.*)$ {
    proxy_pass http://ip:port/method=$method&guid=$guid&entity=$entity;
    }
    zarte
        3
    zarte  
       Jul 22, 2020
    一般是把 /a/b/c 变成 host?path=/a/b/c 这样
    byzf
        4
    byzf  
       Jul 22, 2020
    你这个路径里是不是少了个?.
    TripleZ
        5
    TripleZ  
       Jul 22, 2020 via iPhone
    二楼正解
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1023 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 18:43 · PVG 02:43 · LAX 11:43 · JFK 14:43
    ♥ Do have faith in what you're doing.