Local SWA app needs DAB API on "data-api/api". When deployed it calls just "api"

Maarten van de Bospoort 15 Reputation points
2025-10-16T23:42:53.6833333+00:00

Now that Database Connection will be retired per 11/1, we decided to host DAB in an Azure Container App. We got it to work but there is a difference between running locally and deployed to Azure.

When I run DAB locally on port 5000 in one terminal, my SWA app can connect to it if the path starts with "/data-api/api". When the SWA app is deployed to Azure, the DAB API needs to be called with "/api". Am I missing a setting somewhere?

We could hack a workaround but we'd rather not.

Thanks!

P.S. For what it's worth, there are only examples for using the retired database connections feature with SWA. There is no sample I can find that shows calling a container hosted DAB.

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Vimal Lalani 1,740 Reputation points Microsoft External Staff Moderator
    2025-10-20T06:34:58.3633333+00:00

    Hi @Maarten van de Bospoort

    Thank you for posting your question on Microsoft Q&A.

    You’re not missing a setting. It is expected behavior based on how Azure Static Web Apps (SWA) routes requests to Data API Builder (DAB).

    When using SWA Database Connections, DAB endpoints are always hosted under the /data-api base path. The DAB REST path (default /api) is appended to it, so your requests should look like:

    GET /data-api/api/<entity>

    The /api route (without /data-api) is reserved for Azure Functions APIs in Static Web Apps. If /api/... works in your deployed environment, you are most likely calling a Functions endpoint, not DAB.

    In short:

    /data-api/api → for DAB (Database Connections)

    /api → for Azure Functions or standalone APIs

    Hope this clarifies the routing difference.

    Feel free to post back if you need further help.


Your answer

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