Apache mod evasive blockt mapfish3 print

Issue #599 open
Dominik Fröhlich created an issue

Hallo zusammen,

ich hatte jetzt schon öfter den Effekt, dass die Druckfunktion mod_evasive auf den Plan ruft, das in den Statusabfragen des mapfish3 print services eine DOS Atacke erkennen will und dann die betreffende IP banned.

Um das zu verhindern habe ich bei den Abfragen einen delay von 1 Sekunde eingebaut. Das ist für die user immer noch absolut schnell genug und ich fahre bei großen prints keine DOS Attacken gegen mich selbst.

Ich habe dazu in /modules/tools/print_/mapfish3PlotService.js:356ff die funktion waitForPrintJob folgendermaßen modifiziert:

waitForPrintJob: function (response) {
        const printAppId = this.get("printAppId"),
            url = this.get("mapfishServiceUrl") + printAppId + "/status/" + response.ref + ".json";

        this.sendRequest(url, "GET", function (status) {
            // Error processing...
            if (!status.done) {
                // we need to wait a little here to not DOS ourselves (delay by 1 sec, resp. 1000ms)
                const date = Date.now();
                let currentDate = null;
                do {
                    currentDate = Date.now();
                } while (currentDate - date < 1000);

                this.waitForPrintJob(response);
            }
            else {
                LoaderOverlay.hide();
                this.downloadFile(this.get("mapfishServiceUrl") + printAppId + "/report/" + response.ref, this.get("filename"));
            }
        });
    },

Könnte man evtl auch in den Hauptbranch übernehmen. Dazu am Besten die statischen 100ms durch eine konfigurierbare Variable ersetzen.

Grüße aus Freiburg,

Dominik

Comments (1)

  1. Log in to comment