Rule Set Editor: Opening Blank Window When Editing Rules
I recently found one issue when I tried to edit any existing rule, a blank window opened, as shown in the screenshot.
Upon investigation, I found a JavaScript error causing a 404, resulting in the blank window. It’s clear that there’s something wrong with the request URL.
To confirm this, I’ve narrowed down the countries from the highlighted rule above and surprisingly, it opened the window with the selected countries.
Now I understand the issue logically. Sitecore employs the GET request method to open the shell application for the SelectItems dialog. This works properly when the query string length remains within the allowed limit. However, once it exceeds this limit, it triggers a 404 error. This is the example URL —
https://cm.dev.local/sitecore/shell/default.aspx?xmlcontrol=Sitecore.Shell.Applications.Dialogs.SelectItems&hdl=1FE8A5B1CF5747369A12B05CBD1976C7&ro=sitecore%3A%2F%2Fmaster%2F%7B22FA448D-1AB8-41CC-9EB6-5D4D3A2F579F%7D%3Flang%3Den%26ver%3D1&filterItem=sitecore%3A%2F%2Fmaster%2F%7B7CF7A4AA-CC39-4C91-8F33-71E89CFBEB4E%7D%3Flang%3Den%26ver%3D1&ic=People%2F16x16%2Fcube_blue.png&txt=Select%20the%20items%20to%20use%20in%20this%20rule.&ti=Select%20item&rt=Id&itms=sitecore%3A%2F%2Fmaster%2F%7B6EB5A89C-2F28-47E3-99B6-23398665CC73%7D%3Flang%3Den%26ver%3D1%7Csitecore%3A%2F%2Fmaster%2F%7B557A9A7D-3BC2-43D1-900D-59B28238E953%7D%3Flang%3Den%26ver%3D1%7C
Solution:
The recommended solution for this issue is to switch from using the GET method to the POST method, which effectively resolves such problems.
However, altering the method in the Sitecore Shell application could pose a risk. We’ll need to conduct thorough testing to ensure that the change won’t cause any disruptions. Additionally, there’s uncertainty about its impact on future upgrades.
So, I opted for an alternative solution to address this issue —
Step 1 — Apply a patch to the configuration in your Web.config file within the <system.webServer> section.
<security>
<requestFiltering removeServerHeader="true">
<requestLimits maxAllowedContentLength="524288000" maxUrl="40960" maxQueryString="20480" />
</requestFiltering>
</security>
Step 2 — Now, apply a patch to the httpRuntime configuration within the <system.web> section of your Web.config file.
<httpRuntime targetFramework="4.7.1" maxRequestLength="512000" maxQueryStringLength="512000" executionTimeout="86400" enableKernelOutputCache="false" relaxedUrlToFileSystemMapping="true"
requestValidationMode="4.0" enableVersionHeader="false" requestValidationType="Sitecore.Web.RequestValidators.SitecoreBackendRequestValidator, Sitecore.Kernel" />
This should resolve the max query string length issue for the GET request without affecting any other functionality. Additionally, you can adjust the maxQueryString length and other properties according to your specific use case.
You can find my other blogs here.
Thank you!