Open simonaco opened 4 years ago
With BYO API, you can now host your APIs on other Azure services https://docs.microsoft.com/en-us/azure/static-web-apps/apis-overview.
Moreover, Azure Functions no longer supports Proxies since Azure Function version 4. Azure Functions Proxies have been replaced with Azure API Management proxies, and it could resolve your issue
Update: Functions now supports proxies in Azure Functions v4 - https://learn.microsoft.com/en-us/azure/azure-functions/legacy-proxies#re-enable-proxies-in-functions-v4x Although it is highly recommended that one sticks to APIM support which is now available in Static Web Apps -https://docs.microsoft.com/en-us/azure/static-web-apps/apis-overview
+1 to this. At minimal, this should be documented in the docs. I wasted hours trying to figure out why my route redirects wouldn't work for something like this. Every other product like Netlify/Vercel/etc can do this with 1 line of code. It would be nice to have a little empathy for the developers who are not using all microsoft services to make their life easier.
Originally reported by @MarkXA
Is your feature request related to a problem? Please describe. One of my static sites allows users to subscribe to a calendar at /events.ics. This URL is proxied through to https://uglyblobstorage.url/container/events.ics, which is regularly updated by an Azure Function on a timer trigger. It would be good to be able to do this in Static Web Apps.
Describe the solution you'd like Add a proxies feature to routes.json. Just nick the Azure Functions Proxies code, I'm sure they won't mind ;)
Describe alternatives you've considered A 302 redirect sort of works for now, but it's possible that if the backend URL changed then it would break people's subscriptions, and anyway you don't always want the ugly URL exposed.
Additional context This can also be useful for hosting external APIs as a local /api (e.g. non-JS Azure Functions 😱), particularly if you can't configure their CORS.