Condition in location for proxy_pass

Dear List ,

I need to do a conditional proxy_pass , but it’s not happening as
expected
.

like

set $target
http://www.example.com/sso/url.ping?TargetUrl=http://www.example.com/home

And that $target , I would like to check with $request_uri in below
segment
.

location /sso/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
----------

        ----------
            proxy_pass         http://10.20.137.21;
            }

Dear List ,

I need to do a conditional proxy_pass , but it’s not happening as
expected
.

like

set $target
http://www.example.com/sso/url.ping?TargetUrl=http://www.example.com/home

And that $target , I would like to check with $request_uri in below
segment
.

location /sso/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
----------
if ($target ~ $request_uri) {
proxy_pass http://10.20.137.21;
}
else {
return 403;
}
------------
}

Is that possible achieve inside “location” for “proxy_pass” .

–trm

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs