Overview
SearchStax Managed Search service Solr queries may be submitted using either the GET or POST HTTP method. The query string of a GET request is included as part of the URL in the request header. In a POST request, the query string is part of the data payload and does not inflate the header size.
Some applications, notably Sitecore, generate very large query strings that can exceed the maximum HTTP header size of a GET request, resulting in HTTP 413 errors.
If your queries run out of header space, you’ll be interested in these possible strategies:
- Adjust HTTP header size. The header size can be increased as needed on Azure single-node deployments; but only up to a limit of 32 KB on Azure clusters. This means that large header sizes on test (single-node) deployments often cannot be transferred to production clusters on Azure.
- Use POST queries instead of GET queries. This moves the query string out of the HTTP header into the body of the request.
- Adjust the query complexity to reduce the size of the query string. See Solr query error – URI Too Long for suggestions on how to pare down the Sitecore queries to meet this limitation. Ultimately, you’ll need to discuss this with Sitecore support.
Using POST Queries
If you encounter this 413 heading error in a non-Sitecore context, you can issue POST query requests using the following Linux curl or Windows PowerShell request formats.
Linux:
curl -d "q=*:*&rows=1" https://ss123456-dkwl9slx-ca-central-1-aws.searchstax.com/solr/filmcollection/select
Note that the -d (data) switch automatically casts the request as a POST message.
PowerShell:
$params= @{ q='*:*' rows=10 wt='json' indent='true' fl='id,movie_title,title_year' } $queryresults = Invoke-RestMethod -Method Post -body $params ` -ContentType 'application/x-www-form-urlencoded' ` -uri "https://ss123456-dkwl9slx-ca-central-1-aws.searchstax.com/solr/filmcollection/select"
Questions?
Do not hesitate to contact the SearchStax Support Desk.