Nginx-如何替换字符串

时间:2019-05-08 17:25:50

标签: nginx

请求通过以下端口5082到达服务器

GET /iFooBar?mode=update&av=V12-00-068_466533&rv=0&sv=0&os=Linux&os_arch=aarch64&os_ver=4.15.0-1031-raspi2 HTTP/1.0

我想将其传递给反向代理,如下所示:

GET /iFooBar?mode=update&av=V12-00-068_466533&rv=180144&sv=0&os=Linux&os_arch=amd64&os_ver=4.9.0-9-amd64 HTTP/1.1

参数:

rv=0应该作为rv=180144

传递

os_arch=aarch64应该作为os_arch=amd64

传递

os_ver=4.15.0-1031-raspi2应该作为os_ver=4.9.0-9-amd64

传递

我的配置:

server {
    listen 5082;
    listen [::]:5082;
    server_name mytest.server.com;
    location / {
      #rewrite    ^(.*)aarch64(.*)$    $amd64$2; #// Not working
      proxy_pass http://10.10.10.10:5080;
      proxy_set_header   Connection keep-alive;
      proxy_read_timeout  1200s;
      client_max_body_size 0;
    }
}

0 个答案:

没有答案