V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
sinotw
V2EX  ›  程序员

求助一个 nginx 的 rewrite 的写法

  •  
  •   sinotw · 2020-07-22 16:29:48 +08:00 · 1427 次点击
    这是一个创建于 1367 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

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

    5 条回复    2020-07-22 21:21:03 +08:00
    march13th
        1
    march13th  
       2020-07-22 16:55:53 +08:00
    mark 等待用例
    我目前还没出现这种需求过
    GM
        2
    GM  
       2020-07-22 16:57:49 +08:00   ❤️ 3
    location ~ ^/(?<method>.+)/(?<guid>.*)/(?<entity>.*)$ {
    proxy_pass http://ip:port/method=$method&guid=$guid&entity=$entity;
    }
    zarte
        3
    zarte  
       2020-07-22 17:20:31 +08:00
    一般是把 /a/b/c 变成 host?path=/a/b/c 这样
    byzf
        4
    byzf  
       2020-07-22 18:56:24 +08:00
    你这个路径里是不是少了个?.
    TripleZ
        5
    TripleZ  
       2020-07-22 21:21:03 +08:00 via iPhone
    二楼正解
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2974 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 11:10 · PVG 19:10 · LAX 04:10 · JFK 07:10
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.