Search code examples
catalystbyzohozohocatalyst

Remove "/app" prefix for my React app routes hosted in Catalyst Web Client Hosting


I have created a React App in Zoho Catalyst and hosted it using Web Client Hosting. Since by default all the client routes start with "/app" I wished to remove it using the API Gateway rules and created the below API rule

Request Method: GET

Request URL: /{path1:(.*)}

Target: Web Client Hosting

Target URL: /app/{path1}

I used the above API rule as shown in this Stack Overflow query here. It didn't work in my use case which leads me to believe that there is something I am doing wrong or missing. Can someone help me on that?


Solution

  • The above rule only applies for Basic Web Client that uses HTML and CSS. React Web clients requires another APIG rule apart from the first one you already added which can find below:

    Request Method : GET
    Request URL : /app/{path1:(.*)}
    Target     : Web Client Hosting
    Target URL : /app/{path1}
    

    You can also try hosting your React app in AppSail where the /app prefix won't be added so you won't need to add these APIG rules. To know more about Catalyst AppSail you can check here.