Content-Type declares what the response body represents. Correct media types help browsers and applications process it safely and predictably.
Describe the actual body
Content-Type: text/html; charset=UTF-8The media type identifies the format. A charset parameter, where applicable, describes the text encoding. Common examples include text/html, text/css, text/javascript, application/json, and image/svg+xml.
A filename or extension is not a substitute for a correct response type. A URL ending in .json can still return an HTML error page.
Types and browser loading
With X-Content-Type-Options: nosniff, scripts and styles must have suitable types. Fix the response routing and media type when they fail, rather than weakening the browser policy.
Use the appropriate type for downloads too. Content-Disposition can express an attachment and filename; Content-Type alone is not a safe file-upload validation mechanism.
Inspect status, headers, and body
Check the final response after redirects, authentication, and proxy handling. Confirm that a successful asset request returns the expected bytes and that error responses use the correct type for their error body.
Declared text encoding should match the bytes actually emitted. Avoid duplicate conflicting Content-Type fields from PHP and server rules. See MIME troubleshooting for a practical sequence.