How can I address CORS issues when using background functions? To my knowledge these functions automatically return a 202 status and do not support custom headers or response bodies. Regular Netlify functions allow header customization but are not suited for long-running tasks due to timeout constraints. However, setting custom headers globally does not seem to apply to serverless or background functions. I’m trying to understand the best practices for handling POST requests with background functions while ensuring CORS compliance. What strategies or alternatives could be recommended for this scenario?
I found a workaround for invoking Netlify’s background function by implementing a serverless function to handle the CORS headers. The serverless function initiates the background function, managing the function call and any required data processing. Since both the serverless and background functions are hosted on the same domain, configuring CORS headers for the background function is unnecessary.
thanks for coming back and marking your solution!