Problem—The JSON API requests which have a payload that contains array ([ ]) as part of it are responded with a 400 bad request.
Example
https://x.x.x.x/app/api/rest?formatType=json&opName=userAPISubmitWorkflowServiceRequest&opData=
{param0:"sample",param1:{"list":[{"name":"sample","value":"sample"},{"name":"sample","value":"sample"}]},
param2:1000}
-
This URL responds with a 400 status code on Cisco UCS Director release 6.7 when accessed from a browser or any other REST client.
-
This URL responds with a 200 status code on Cisco UCS Director release 6.6 when accessed from a browser or any other REST client.
Possible Cause—This issue is due to modifications in Tomcat server configuration in version 6.7. Newer versions of Tomcat do not allow the
array ([ ]) character in the URL of a HTTP request as it is against the HTTP 1.1 specification.
Recommended Solution—To fix this issue, URL must be encoded as shown below:
https://x.x.x.x/app/api/rest?formatType=json&opName=userAPISubmitWorkflowServiceRequest&opData=
%7bparam0:%22sample%22,param1:%7b%22list%22:%5b%7b%22name%22:%22sample%22,%22value%22:%22sample%22%7d,
%7b%22name%22:%22sample%22,%22value%22:%22sample%22%7d%5d%7d,param2:1000%7d
Other characters that need to be encoded are: |, {, }, [, ], \, \\, ^, `
If encoding is not preferred, mention the characters (|, {, }, [, ], \, \\, ^, and `) in the server.xml
configuration file.
Add the following line to the server.xml
file in the Tomcat server (in the Cisco UCS Director appliance, the file is located at the /opt/infra/web_cloudmgr/apache-tomcat/conf
path):relaxedQueryChars="|,{,},[,],\,\\,^,`”
Configuration now should look like this:
<Connector SSLEnabled="true" URIEncoding="UTF-8" ciphers="TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_128_CBC_SHA256,
TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA"
clientAuth="false" keystoreFile="keystore/.keystore" keystorePass="cloupia123" maxHttpHeaderSize="65536"
maxPostSize="-1" maxThreads="150" port="8443" protocol="HTTP/1.1" scheme="https" secure="true" server="Web"
sslEnabledProtocols="TLSv1.2,TLSv1.1" sslProtocol="TLS" relaxedQueryChars="|,{,},[,]"/>
<Connector URIEncoding="UTF-8" maxHttpHeaderSize="65536" maxPostSize="-1" port="8080" protocol="HTTP/1.1"
redirectPort="443" server="Web" relaxedQueryChars="|,{,},[,],\,\\,^,`"/>
Note |
The services must be restarted after making the changes.
|