appgw - homepage only redirect but other forward to backend

srinu P 1 Reputation point
2022-11-14T23:32:42.937+00:00

Hi, we have url setup on azure app gateway with backend pool. need to redirect ONLY homepage to specific path but all other uri paths should go to backend pool. I tried with path based rule but its taking /* it means all ur's after / rediecting to that path but i want only equal homepage redirect. is that doable .

Azure Application Gateway
Azure Application Gateway
An Azure service that provides a platform-managed, scalable, and highly available application delivery controller as a service.
1,217 questions
{count} votes

1 answer

Sort by: Most helpful
  1. GitaraniSharma-MSFT 50,096 Reputation points Microsoft Employee Moderator
    2022-11-22T13:17:27.247+00:00

    Hello @srinu P ,

    I understand you have URL setup on Azure Application gateway with backend pool and needed to redirect ONLY the homepage to specific path, but all other URI paths should go to backend pool. You tried with path-based rule but it was taking /* meaning all uri's after / redirecting to that path. You also wrote a rewrite rule but it was redirecting everything again to new URI path. Your requirement is:
    hostname.com/ -> hostname.com/ecom/spid/
    hostname.com/[anything] -> backend pool

    I discussed this with the Azure Application gateway Product Group team and below is their response:

    This isn’t possible via redirect rules out of box, but can be possible via workaround (albeit a bit inefficient, but possible).

    1) Create a new rewrite rule to change any request for “/” to be rewritten with a placeholder path and have the path-map reevaluated.

    263066-image.png

    2) Create a redirect rule for the fictitious path to redirect to the proper path via external website reference.

    262980-image.png

    Kindly let us know if the above helps or you need further assistance on this issue.


    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.