VMware Networking Community
ymunakata
Contributor
Contributor

ha proxy

I would like to use application rule of ESG to redirect new connection to a sorry page while servers are out of service. I wonder if we can use whole syntax of HAProxy. It would be nice someone shows a sample above scenario.

Thanks in advance,

Yuichiro

0 Kudos
4 Replies
larsonm
VMware Employee
VMware Employee

Were you able to answer your own question?  The question is marked as Assumed Answered.

0 Kudos
ymunakata
Contributor
Contributor

Thank you very much for your attention to me.

No I can't. I put full script as below, apllication rules was NOT accepted that. I put server syntax to allow to redirect sorry page, application rules was accepted that. I'll see if the application rules I applied work and get back to here again.

frontend frontend_test

     bind 0.0.0.0:80

     acl test_dst_port dst_port 80

     use_backend backend_test if test_dst_port

backend backend_test

     balance roundrobin

     server backend_1 1.1.1.1 check

     server backend_2 1.1.1.2 check

     server sorry_page 1.1.1.3 backup

Thanks in advance,

Yuichiro

0 Kudos
ddesmidt
VMware Employee
VMware Employee

Three are multiple ways (like always in load balancers) to achieve the same thing.

Here are a few examples of possible options:

OPTION1: In case of servers in the primary pool are all dead, use servers in the secondary pool

Create an Application Rule (Under "Edge – Manage /  Load Balancer / Applications Rules")

# detect if pool "pool_production" is still UP

acl pool_production_down nbsrv(pool_production) eq 0

# use pool "pool_sorry_server" if "pool_production" is dead

use_backend pool_sorry_server if pool_production_down

Apply that Application Rule to the Virtual Server (Under "Edge – Manage /  Load Balancer / Virtual Servers")

OPTION2: Redirect EVERYTHING to maintenance site

Create an Application Rule (Under "Edge – Manage /  Load Balancer / Applications Rules")

redirect location http://maintenance.xyz.com/maintenance.htm

Apply that Application Rule to the Virtual Server (Under "Edge – Manage /  Load Balancer / Virtual Servers")

OPTION3: Use a specific maintenance server pool + rewrite all URL to /maintenance.php

Create an Application Rule (Under "Edge – Manage /  Load Balancer / Applications Rules")

# Match everything

acl match_all always_true

use_backend maint_pool if match_all

# Rewrite all url with "/maintenance.html"

reqirep ^GET\ (.*)\ HTTP/(.*)  GET\ /maintenance.php\ HTTP/\2

Apply that Application Rule to the Virtual Server (Under "Edge – Manage /  Load Balancer / Virtual Servers")

Dimitri

ymunakata
Contributor
Contributor

Thank you very much for your attention to me. Options you provided works fine on my test bed.

Thanks again,

Yuichiro

0 Kudos