0

I have a multisite setup in sitecore 9.1 and getting the below error on

ERROR MediaRequestProtection: An invalid/missing hash value was encountered. The expected hash value

I know the reason for this error and Instead we want to suppress this for one website alone. All other websites should still report in logs. Is there any config/ setup for this? Thanks in advance.

1 Answer 1

2

You can add your site to sitecore/mediaLibrary/requestProtection/ignoreSites config node.

By default in 9.1.0 that setting is in App_Config\Sitecore\CMS.Core\Sitecore.Media.RequestProtection.config

<sitecore role:require="Standalone or ContentDelivery or ContentManagement">
  <mediaLibrary>
    <requestProtection>
      <!--  IGNORE SITES
            Specifies a list of site names for which the media protection module should not sign image ULRs with a hash value. When
            Sitecore processes an incoming media request for these sites, it does not check if there is a valid hash value.
      -->
      <ignoreSites>
        <site name="shell"/>
        <site name="login"/>
        <site name="admin"/>
        <site name="service"/>
        <site name="scheduler"/>
        <site name="system"/>
        <site name="publisher"/>
      </ignoreSites>

Make sure you add your changes via Sitecore config patch file. Something like this should do the trick:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/"> 
  <sitecore role:require="Standalone or ContentDelivery or ContentManagement">
    <mediaLibrary>
      <requestProtection>
        <ignoreSites>
          <site name="my-custom-site">
            <!-- I disabled media protection for my-custom-site-on-purpose -->
          </site>
        </ignoreSites>
      </requestProtection>
    </mediaLibrary>
  </sitecore>
</configuration>
3
  • Thank you for responding. I will try this out. Commented Jan 12, 2022 at 3:52
  • I had added a patch config as said above and see it in showconfig Commented Jan 17, 2022 at 10:21
  • '<requestProtection patch:source="Sitecore.Media.RequestProtection.config"> <ignoreSites> <site name="shell"/> <site name="login"/> <site name="admin"/> <site name="service"/> <site name="scheduler"/> <site name="system"/> <site name="publisher"/> <site name="<MYSITE>" patch:source="RequestProtection.config"/> </ignoreSites> </requestProtection>' But still getting the above error. Commented Jan 17, 2022 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.