Issue
When a very long path is included in a request to the SmartConnector RESTful EWS gateway, such as when attempting to acknowledge an alarm with a long path, the gateway returns the error "HTTP Error 400: The request URL is invalid."
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request - Invalid URL</h2>
<hr><p>HTTP Error 400. The request URL is invalid.</p>
</BODY></HTML>
Product Line
EcoStruxure Building Operation
Environment
SmartConnector
Cause
In Windows, the default maximum number of characters in a URL path segment (the area between the slashes in the URL) is 260 characters. When the object path, after double URL encoding, exceeds 260 characters, it triggers error 400.
Resolution
To resolve this issue, follow these steps:
- Add a registry key "UrlSegmentMaxLength" to the following path in the SmartConnector PC registry: Path: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\HTTP\Parameters Name: UrlSegmentMaxLength Type: DWORD Value: 0 - 32,766 (e.g., set the value to 1000)
- After adding the registry key, restart the HTTP services or restart the PC. Detailed instructions for this process can be found in the "Http.sys registry settings for Windows" guide on the Microsoft Learn website. Http.sys registry settings for Windows - Internet Information Services | Microsoft Learn