diff --git a/typo3/sysext/extbase/Classes/Core/Bootstrap.php b/typo3/sysext/extbase/Classes/Core/Bootstrap.php
index 2b9b79b8bcbe6d2986e966f8746eb27c39f5b6d8..3ebf72177eadc16acb9c265eda76e88905aa24fd 100644
--- a/typo3/sysext/extbase/Classes/Core/Bootstrap.php
+++ b/typo3/sysext/extbase/Classes/Core/Bootstrap.php
@@ -180,10 +180,9 @@ class Bootstrap
         if (($typoScriptFrontendController = ($GLOBALS['TSFE'] ?? null)) instanceof TypoScriptFrontendController
             && $response->hasHeader('Content-Type')
         ) {
-            [$contentType] = explode(';', $response->getHeaderLine('Content-Type'));
+            $typoScriptFrontendController->setContentType($response->getHeaderLine('Content-Type'));
             // Do not send the header directly (see below)
             $response = $response->withoutHeader('Content-Type');
-            $typoScriptFrontendController->setContentType($contentType);
         }
 
         if (headers_sent() === false) {
diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
index 04a94d4e3ca6873fbdec5a4a499681a494e03c1a..7b7d450441a8b1fa74391b78c917259031ae5e93 100644
--- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
+++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
@@ -2913,8 +2913,11 @@ class TypoScriptFrontendController implements LoggerAwareInterface
     public function applyHttpHeadersToResponse(ResponseInterface $response): ResponseInterface
     {
         // Set header for charset-encoding unless disabled
-        if (empty($this->config['config']['disableCharsetHeader'])) {
+        if (empty($this->config['config']['disableCharsetHeader']) && !str_contains($this->contentType, 'charset=')) {
             $response = $response->withHeader('Content-Type', $this->contentType . '; charset=' . trim($this->metaCharset));
+        } elseif ($this->contentType && $this->contentType !== 'text/html') {
+            // send the contentType, if defined differently than text/html
+            $response = $response->withHeader('Content-Type', $this->contentType);
         }
         // Set header for content language unless disabled
         $contentLanguage = $this->language->getTwoLetterIsoCode();