Select to view content in your preferred language

sql where clause length limit? get request returns 404 error

3785
7
Jump to solution
04-26-2021 08:06 AM
PatSmyth
Occasional Contributor

Hi - We have a custom application filter that allows users to build complex queries and execute them again an ArcGIS REST API endpoint published to our federated ArcGIS enterprise environment. The functionality works fine for medium query strings (< 10 clauses). However, large query strings ( > 10 clauses) will intermittently throw a 404 File or Directory Not Found Error. We are executing said queries as a GET request as that is an application requirement at the moment. Is there a specified query length limit for GET requests against ArcGIS REST API endpoints? Is this documented anywhere? Thanks!

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
Nicholas-Furness
Esri Regular Contributor

Hmm. Smells really familiar. I recently worked with someone whose IIS configuration blocked requests over a certain length (2130 characters - didn't matter if they were GET or POST). Requests over that length would resolve to 404s. And of course, that looked like an intermittent issue as queries got around the 2130 mark.

Can you check that your IIS configuration isn't doing the same? Once they fixed that, they were able to perform more complex queries. I never learnt why their IIS was configured that way, but it doesn't seem to be the default (note, this isn't really my wheelhouse, but this sounded familiar enough for me to throw this out there).

View solution in original post

7 Replies
Nicholas-Furness
Esri Regular Contributor

Hmm. Smells really familiar. I recently worked with someone whose IIS configuration blocked requests over a certain length (2130 characters - didn't matter if they were GET or POST). Requests over that length would resolve to 404s. And of course, that looked like an intermittent issue as queries got around the 2130 mark.

Can you check that your IIS configuration isn't doing the same? Once they fixed that, they were able to perform more complex queries. I never learnt why their IIS was configured that way, but it doesn't seem to be the default (note, this isn't really my wheelhouse, but this sounded familiar enough for me to throw this out there).

PatSmyth
Occasional Contributor

Thanks for this. I hadn't thought about IIS configs, but going to dig into and see if there is indeed a limit that is resulting in the 404s. 

0 Kudos
PatSmyth
Occasional Contributor

Found the setting in IIS that I believe will do the trick. Thanks for guiding me in the right direction!

For anyone out there with this issue: from the IIS site that hosts your arcgis server web adaptor(s) - note this may need also happen wherever portal web adaptors are as well, but in our case they are part of the same IIS Default site - do the following:

  • Select Request Filtering
  • Select Edit Request Filtering
  • Change default limits on Max Url Length and Max Query String 
    • there are wildly differing suggestion out there on what to change it too, in our case I'm going to try and get a handle on longest query string we're trying to pass and then set a nice cushion from that benchmark

IIS Restart seems to be required for this config change to stick, so we'll be doing it over the weekend to avoid downtime. 

 

ChelseaRozek
MVP Regular Contributor

You're my hero, thanks for posting exactly where to look! Was able to fix my issue

0 Kudos
AndrewBowne
Frequent Contributor

Is it possible to restructure your query and trim it down a bit?  

0 Kudos
PatSmyth
Occasional Contributor

this is what we did and we were able to get queries working again, however, we were still a bit irked by the non-descript 404 errors and by the fact that in the REST api spec there is no stated limit on query length as far as I now. 

AndreLoerch
Emerging Contributor

We're encountering this same issue. In our case, it's the IIS request filtering's maximum query length (2048 bytes) that is the issue... a REST API query, beginning at the word 'query' of 2043 characters works, and at 2052 characters we get 404 file/folder not found 😬 

Our solution has typically been to write our custom applications to send the queries in batches.

I have not seen any recommendations from Esri on what these parameters should be, only that there is an Esri support article on how to update them (which seems outdated). 

Have any of you tried adjusting these parameters? Have you found values that work? Was there any performance impact?

0 Kudos