获取参数Nginx和proxy_pass的path

我有这个url

http://localhost:8888/images/upload/root/folderA/folderB?arg1=A&arg2=B 

所以,我想redirect到:

 http://localhost:8080/v1/files_upload/ 

它一定是这样的:

 http://localhost:8080/v1/files_upload/root/folderA/folderB?arg1=A&arg2=B 

我有以下几点:

 location ~ ^/images/upload/([^/]+)(/.*)\?(.*)$ { upload_pass @after_upload; ... ... } location @after_upload { proxy_pass http://localhost:8080/v1/files_put/$1/$2?$3; } 

我检查了它,只工作$ 1$ 2 ,但参数$ 3不发送到proxy_pass

提前致谢!

location指令不匹配请求参数,它只检查请求路径。 你应该使用$args变量(或者更具体的$arg_arg1$arg_arg2 ):

 location @after_upload { proxy_pass http://localhost:8080/v1/files_put/$1/$2?$args; }