0

I am using Geoserver with an app written with OpenLayers 3. The app can download zipped shapefiles using a WFS service, which works unless I make a large (long URL) request. In that case I get a 413 error in Chrome.

Is there a way I can change this setting so that I can make a longer request to Geoserver (or is the problem something else?

Here is the request:

            $('#btnDownloadSHP').click(function (e) {

            var tostring = '(' + ids.toString() + ')';
                var data = {
                    service: 'WFS',
                    version: '1.1.0',
                    request: 'GetFeature',
                    typename: 'download_layer',
                    format_options: "filename:" + shapefileName,
                    srsname: 'EPSG:3857',
                    outputFormat: 'SHAPE-ZIP',
                    CQL_FILTER: "id IN " + tostring
                }

                var parameters = Object.keys(data).map(function (key) {
                    return key + '=' + data[key]
                }).join('&');

                var url = "http://" + servername + "/geoserver/wfs?" + parameters;

                //make dummy link and download shapefile
                var link = document.createElement("a");
                link.download = 'Features';
                link.href = url;
                link.click();

           // }
        });
JasonBK
  • 539
  • 3
  • 12
  • 37

1 Answers1

1

That response would be generated by the server that GeoServer is running on rather than GeoServer itself. So depending on which httpd and/or servlet engine you are using you may be able to fix it there.

But the easy answer is to switch from GET to POST.

Ian Turton
  • 10,018
  • 1
  • 28
  • 47
  • thanks, I found that out already but haven't yet figured out how to change the existing code above with the dummy link to use POST – JasonBK Apr 18 '19 at 19:11