Nginx动态代理重定向

sil*_*min 3 proxy nginx

我希望能达到这样的目的:

location = / {
    if ($args ~ "^url=(.+)") { #gets the "url" get parameter
        set $key1 $1;
        proxy_pass $key1; #use the parameter as proxy address
    }
}
Run Code Online (Sandbox Code Playgroud)

这甚至可能吗?

VBa*_*art 7

location / {
    proxy_pass http://backend$arg_url;
}
Run Code Online (Sandbox Code Playgroud)

  • http://nginx.org/r/proxy_redirect和http://nginx.org/en/docs/http/ngx_http_sub_module.html通常我会在官方文档的每个链接上花费5美元,每条报价都需要100美元. (2认同)