nginx conf request forwarding and filtering profiles

// location ~ /test/(.*) so that the latter can obtain the address specified uri set $ para1 $ 1 by the method of variables; $ para1

location ~ /test/(.*){
         set $foo hello;
         echo "test test test";
               echo "foo: $foo";
         echo "uri = $uri";
              echo "request_uri = $request_uri";  
        set $para1 $1;
        set $para2 $2;
        echo "par1:$para1";
        echo "para2:$para2";
    
        rewrite     $request_uri $para1;
        echo "update :$request_uri";
        echo "station: $arg_station";
        if ( $arg_station = '2' )
        {     echo "222222";}
        mirror /mirror    ;
        mirror /mirror2;
    }
    location /mirror{
         access_log  /usr/local/nginx/logs/access1.log  main;
          echo "mirror----header-2:$http_station";
        proxy_pass http://10.166.18.223:8089/$para1;
        proxy_set_header X-Original-URI $request_uri;
                 proxy_set_header station $http_station;

        proxy_set_header Host       $proxy_host;
         proxy_pass_request_body on;
             }
     
               location /mirror2{
          access_log  /usr/local/nginx/logs/access2.log main ;
          echo "mirror2----header-2:$http_station";
    
                  proxy_pass http://10.166.18.224:8089/$para1;
          proxy_set_header X-Original-URI $request_uri;
        proxy_set_header Host       $proxy_host;
          proxy_set_header X-Original-URI $request_uri;
    
         proxy_set_header station $arg_station;
                  proxy_pass_request_body on;
             }
    location /test/aa{
        
    echo "test/aa";
    }

Guess you like

Origin www.cnblogs.com/xuhansan/p/11776519.html