CF2021 - GET request content-type stuck in text/plain
We've got an intranet hosting web apps written in ColdFusion with some RESTful services set up to query from our databases and return JSON for the web pages. Recently, we upgraded our development server from ColdFusion 2018 to ColdFusion 2021; afterwards, our calls to the REST service began returning objects that break our Javascript. On closer examination in the network tab, the JSON is all present and properly formatted; the only difference we can see is that the 'content-type' header of the returned object is 'application/json' on our production server (still running 2018), but 'text/plain' on our development server.
We've confirmed that the RESTful services are all properly registered on the development server and that the REST API scripts, site scripts, and Javascript are all identical between the development and production servers.
See below an example function from one of our REST API scripts:
<cffunction name="getProject" access="remote" returntype="String" httpmethod="POST" restPath="project">
<!--- Arguments --->
<cfargument name="criteriaStructure" type="struct" required="yes" />
<!--- Access Check --->
<cfif not request.user.authenticated>
<cfreturn notLoggedInMessage />
</cfif>
<!--- Includes --->
<cfinclude template="/GlobalResources/globalComponents/ServerAPI/Utility/Utility.cfm" />
<cfinclude template="/GlobalResources/globalComponents/DatabaseAPI/RESEARCH_FARM_PROJECT/PROJECT.cfm" />
<!--- The Tofu --->
<cfset arguments.criteriaStructure = CRFP_PROJECT_PopulateCriteriaStructure(arguments.criteriaStructure) />
<cfreturn SerializeJSON(CRFP_PROJECT_SelectQuery(arguments.criteriaStructure), serializeQueryByColumns) />
</cffunction>
<cfheader name = "content-type" charset = "utf-8" value = "application/json">
This does not change the content type of the returned object, instead producing a 500 error.
After exploring several potential causes and solutions we resurrected the old 2018 development server and found that it returns JSON objects with the appropriate content type. Since that server is running the same RESTful services with the same APIs, the same server-side page scripts, and the same Javascript, and is even running on the same physical box as the 2021 development server, we are left to conclude that something about ColdFusion 2021 is causing this discrepancy.
We've been through the administrator panel settings several times now and have even used a text comparator tool to compare the settings between the old 2018 and the new 2021 development servers, but we can't identify any setting that may account for this. Can anyone shed any light on why this is happening?
