question

jitendra-5734 avatar image
0 Votes"
jitendra-5734 asked msrini-MSFT commented

Application gateway redirection to 2 backend pools

Dear Community,

     I have a setup wherein i require the application gateway to redirect to 2 backend pools each containing 1 VM .

I have nginx instances on each VM in the backend pool
I have configured the application gateway and it reaches the First backend pool but not the second
Let me make it more clear so that y'all understand it better .
I have both the servers configured in nginx where i've put the locations as /wa1,/wa2,/wa3 and /wa4,/wa5,/wa6 respectively .

In /one we have 3 directories where i have 3 index.html's .
So let me say for namesake that it is wa1 wa2 wa3
In /two we have 3 directories where i have 3 index.html's .
So let me say for namesake that it is wa4 wa5 wa6

Only difference between them is that

1) /one endpoint points to my First backend pool .
2) /two endpoint points to my Second backend pool .

I have configured my nginx like this :

1st Backend pool VM
server {
listen 80;
listen [::]:80;

     server_name example.com;

     root /var/www/html;
     index index.html;

     location / {
             default_type application/json;
             return 200 '{"code":"1", "message": "Connected to one"}';
     }
     location /one/wa1 {
             default_type application/json;
             return 200 '{"code":"1", "message": "Connected to one and wa1"}';
             autoindex on;
     }
     location /one/wa2 {
             default_type application/json;
             return 200 '{"code":"1", "message": "Connected to one of wa2"}';
             autoindex on;
     }
     location /one/wa3 {
             default_type application/json;
             return 200 '{"code":"1", "message": "Connected to one of wa3"}';
             autoindex on;
     }

}

2nd Backend pool VM
server {
listen 80;
listen [::]:80;

     server_name example.com;

     root /var/www/html;
     index index.html;

     location / {
             default_type application/json;
             return 200 '{"code":"1", "message": "Connected to two"}';
     }
     location /two/wa4 {
             default_type application/json;
             return 200 '{"code":"1", "message": "Connected of two of wa4"}';
             autoindex on;
     }
     location /two/wa5 {
             default_type application/json;
             return 200 '{"code":"1", "message": "Connected of two of wa5"}';
             autoindex on;
     }
     location /two/wa6 {
             default_type application/json;
             return 200 '{"code":"1", "message": "Connected of two of wa6"}';
             autoindex on;
     }

Now i have configured the URL rewrites for the server as well , and for the first back end pool it reaches it properly

Meaning in the HTTP URL rewrite tab in nginx , i configured the URL with the names like

/one/wa1 ---> applicationgwip/clientone
/one/wa2 ---> applicationgwip/clienttwo
/one/wa3 ---> applicationgwip/clientthree

/two/wa4 ---> applicationgwip/clientfour
/two/wa5 ---> applicationgwip/clientfive
/two/wa6 ---> applicationgwip/clientsix


Now in the URL when i type appgwip/clientone , appgwip/clienttwo , appgwip/clientthree
It reaches the servers perfectly fine .

But as soon as i hit

appgwip/clientfour , appgwip/clientffive , appgwip/clientsix

It points to location in my / of my first backend pool .
Meaning it hits / of the first backend pool .

This is really weird behaviour considering the fact it reaches it directly if i give

appgwip/two/wa4 .. appgwip/two/wa6

Can someone guide me about how should i be able to redirect http url's to the second backend pool ?

azure-application-gateway
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you for the detailed write up. It would be great if you can provide the Application Gateway config like rules, redirection config, path based routing info to provide you a better answer.

0 Votes 0 ·

0 Answers