I have upgraded to 4.0.56 from 4.0.54 and just noticed that DTO Validation errors (400 - Bad Requests) are coming back from SS with a content-type of text/html rather than application/json even though the Accept request header is correct.
I have made a bunch of changes alongside the upgrade, but having looked through them I can’t see anything that would cause this behaviour. I have also tried setting HostConfig.DefaultContentType = MimeTypes.Json but no effect.
I have been changing some header-based code (e.g. removing Asp.net X-Powered-By etc) but can’t see anything that should/would cause this behaviour. Any ideas on why this could be happening or how to troubleshoot? I can’t debugInfo as all are POSTS.
The description alone without a repro won’t be enough to identify the issue, can you post the raw HTTP Request and Response Headers? You can get them with Fiddler, Chrome WebInspector or WireShark, etc.
After further investigation, previous diagnosis was wrong - hopefully this will avoid someone else wasting time on this.
This is caused by the parent application in IIS having an system.webServer/httpErrors element with a existingResponse=“Replace” attribute in web.config. Even if the httpError element doesn’t contain any child elements relating to the affected HTTP status code (I only want a custom 404), helpfully adjusts all HTTP responses content type to text/html.