ACSD-61845: Error occurs for requests with text/html accept header

The ACSD-61845 patch fixes the issue where an HTTP request with only a text/html accept header causes a 500 error due to media type mismatches in response handling. This patch is available when the Quality Patches Tool (QPT) 1.1.54 is installed. The patch ID is ACSD-61845. Please note that the issue is scheduled to be fixed in Adobe Commerce 2.4.8.

Affected Products and Versions

The patch is created for Adobe Commerce version:

  • Adobe Commerce (all deployment methods) 2.4.7-p1

Compatible with Adobe Commerce versions:

  • Adobe Commerce (all deployment methods) 2.4.7-p1 - 2.4.7-p3
NOTE
The patch might become applicable to other versions with new Quality Patches Tool releases. To check if the patch is compatible with your Adobe Commerce version, update the magento/quality-patches package to the latest version and check the compatibility on the Quality Patches Tool: Search for patches page. Use the patch ID as a search keyword to locate the patch.

Issue

When sending an HTTP request with only text/html in the accept header, a 500 error occurs due to a mismatch in the media type configuration.

Prerequisites:

B2B modules are installed and enabled.

Steps to reproduce:

  1. Send a request with only text/html in the accept header, as follows:

    code language-none
    curl -I --header "Accept: text/html, text/plain" http://<hostname>/pub/
    

Expected results:

The page is returned with a 200 status code.

Actual results:

A 500 error is returned, with the following error message in the exception.log:

Magento\Framework\Webapi\Exception: Server cannot match any of the given Accept HTTP header media type(s) from the request: "text/html" with media types from the config of response renderer. in vendor/magento/framework/Webapi/Rest/Response/RendererFactory.php:84

Apply the patch

To apply individual patches, use the following links depending on your deployment method:

To learn more about Quality Patches Tool, refer to:

Quality Patches Tool: A self-service tool for quality patches in the Tools guide.

recommendation-more-help
c2d96e17-5179-455c-ad3a-e1697bb4e8c3