When a file is uploaded through the File Attachment control on a SmartForm, the POST to /Utilities/FileHandler.ashx doesn’t always include a Content-Type header. We see this consistently with Outlook .msg files, and it probably affects any file type the browser can’t map to a MIME type, since the browser then reports an empty type and the request goes out without the header.
This matters when K2 sits behind a web application firewall or reverse proxy. We’re testing Azure Front Door in front of our K2 server. Front Door can’t inspect a request body without a Content-Type, so it blocks the upload. Other WAFs and API gateways often behave similarly.
Requested change: set the Content-Type header on every upload request. Use the file’s MIME type where the browser knows it, and fall back to application/octet-stream where it doesn’t.
Steps to reproduce:
Open a SmartForm that has a File Attachment control.
Press F12, go to the Network tab and start recording.
Upload a .msg file (an email saved from Outlook).
Find the POST to /Utilities/FileHandler.ashx?fn=<filename>.msg. The request has the file as its body and no Content-Type header.
Observed request sequence:
The form loads (SharedResources.ashx, UserResources.ashx, then several AjaxCall.ashx calls).
The upload: POST to FileHandler.ashx with the file as the body and no Content-Type.
About 3 to 5 seconds later, there’s a single AjaxCall.ashx call, which looks like the SmartObject saving the attachment.
Impact: you can’t reliably put K2 behind Azure Front Door or a similar WAF without adding exclusions for FileHandler.ashx, and that weakens the protection those services exist to provide.