Headers for Static Web Apps
I tried the new Azure Static Web Apps preview for a Gatsby project of mine. I was really amazed by the simplicity of the deployment process and the speed of the web site. There was a deal breaker, though.
What really kept us from switching from Netlify to Azure Static Web Apps was the lack of control over HTTP headers. I need to be able to for example set the cache-control header on a per-file as well as per-directory basis. The same thing goes for the link header, although that would not break the website. There also needs to be an option to set other headers arbitrarily, for example security headers.
I do know, that most of those things could be done with a CDN and we have tried that. The problem with that option is, the limitation of the maximum number of rules and the number of actions per rule. It is impossible to set all appropriate security headers, while still keeping the fine grained control of caching that we need.
If or when Azure Static Web Apps gains the ability to set headers on the same level of detail as Netlify does, it will become a serious competitor to the market leader on the JAM-stack.
Here is a reference to the Netlify way of doing things. I think it is excellent in it's simplicity and could be used as an inspiration for Azure Static Web Apps.
Shahid Iqbal commented
This is a significant gap in this feature, there's an feedback open ever since Azure storage added static hosting capabilities and I was hoping this was something would be part of this feature.
Jesse Barocio commented
+1. I needed to rapidly add a new feature with backend functionality to a WordPress website and figured I could use Static Web Apps and throw it in an iframe. The feature was done and deployed to a Static Web App in 20 minutes. Unfortunately I immediately discovered the default value for X-Frame-Options won't allow it to be served in an iframe. Being able to change this would be nice.
Good thing I only lost 20 minutes on it.