How to add Path based routing for multiple Azure static webapps

Pankaj Shinde 0 Reputation points
2023-08-15T19:08:12.72+00:00

I have set up two static websites using Azure Static Web Apps through GitHub actions. Now I want to group both of these websites under a single application gateway.

Here's the challenge I'm facing:

  • The first website is the default landing page.
  • The second website is a client portal, accessible when a user clicks "Login" on the default website.

I'm attempting to create different paths for these websites:

  • Website 1 path: /*
  • Website 2 path: /client/*

However, when I try to access the public IP address, the default website (Website 1) loads correctly. But when I add "/client/" to the URL, it redirects me back to the same default website.

I'm looking for help to resolve this issue. Can someone guide me on how to fix this problem or let me know if it's possible to use an application gateway with two static web apps?

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,171 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,131 questions
{count} votes

1 answer

Sort by: Most helpful
  1. KapilAnanth-MSFT 49,301 Reputation points Microsoft Employee
    2023-08-29T13:48:22.2633333+00:00

    @Pankaj Shinde

    Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.

    I understand that you would like to use path based routing for multiple backends in Azure Application gateway.

    AFAIK, the /* route is not required.

    Refer : https://learn.microsoft.com/en-us/azure/application-gateway/create-url-route-portal#configuration-tab

    You do not need to add a custom /* path rule to handle default cases. This is automatically handled by the default backend pool.

    User's image

    App gateway will automatically route these request to the default pool.

    Please let us know if we can be of any further assistance here.

    Thanks,

    Kapil


    Please Accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer.

    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.