Forum: NGINX Condition in location for proxy_pass

79c330896eea5cf1233c35ea19f2cbd6?d=identicon&s=25 trm asn (Guest)
on 2012-10-16 18:56
(Received via mailing list)
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...

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;
                }
79c330896eea5cf1233c35ea19f2cbd6?d=identicon&s=25 trm asn (Guest)
on 2012-10-16 19:01
(Received via mailing list)
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...

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
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.