Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nginx dynamic proxy redirection

Tags:

nginx

proxy

I was hoping to achieve something like this:

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

Is this even possible ?

like image 341
silkAdmin Avatar asked Dec 01 '25 09:12

silkAdmin


1 Answers

location / {
    proxy_pass http://backend$arg_url;
}
  • http://nginx.org/r/proxy_pass
  • http://nginx.org/en/docs/http/ngx_http_core_module.html#variables
  • http://wiki.nginx.org/IfIsEvil
like image 157
VBart Avatar answered Dec 03 '25 03:12

VBart