Azure / azure-functions-on-container-apps

Docs , samples and issues for Azure Functions on Azure Container Apps
MIT License
74 stars 18 forks source link

CORS issue on portal (Test/Run) on containerized Function App running in Azure Container Apps #32

Closed IgnacioAguirre closed 6 months ago

IgnacioAguirre commented 1 year ago

I deployed an Azure Function using the QuickStart template selected by default when you create the Function App from the portal. When you create an Azure Function in a Container App, 2 resources are created: a Function App and a Container App.

When you try to use the function's Test/Run feature from Azure Portal, you will face the next CORS Error: "Running your function in portal requires the app to explicitly accept requests from https://portal.azure.com. This is known as cross-origin resource sharing (CORS). Click here to add https://portal.azure.com to the allowed origin configuration."

I tried different ways to mitigate this issue but none of these worked: • If you try to add the CORS Allowed Origins setting using the “Click here” button, it will not work. • The Function App does not have any CORS blade as it is hosted in a Container App. So you cannot do it from the Portal. • If you add the Allowed Origins https://portal.azure.com in the Container App resource, this setting gets cleared once you hit run+test in the Function App. • I also tried to add the CORS setting programmatically via CLI to the Azure Function but it does not work.

image

raorugan commented 1 year ago

Hi @IgnacioAguirre , currently we do not support CORS for functions on ACA resource. Can you please let me know if this is blocking?

IgnacioAguirre commented 1 year ago

Hi @raorugan, I am not blocked because I have other ways to trigger my Azure Functions in ACA like POSTMAN or using any REST client (like curl or PS cmdlet Invoke-WebRequest) where no CORS parameter is needed, but due to this CORS error it cannot be triggered through portal.

If CORS settings are not supported in ACA Functions and not needed, it should not be required/requested by the portal.

raorugan commented 1 year ago

Hi @IgnacioAguirre - Noted! This is in progress. Should be greyed out until the support is out.

raorugan commented 1 year ago

Hi @IgnacioAguirre , this feature will be supported soon! Will keep you posted.

raorugan commented 6 months ago

This feature is now supported

raorugan commented 6 months ago

this feature is now supported