Server logs showing a GET request just before a POST request

When I look at the logs of my server, I see periodic GET requests arriving instantly before a POST request from the same ip with the same referee. I expect POST but not GET. Has anyone seen this before?

I am dynamically creating a form inside an iframe with javascript to send a POST request to the server. I cannot use Ajax because the POST request belongs to a different domain. This works in about 95% of cases. 5% of the time, I get a GET request just before POST. It seems that this comes repeatedly from the same ip.

Here is the server log:

10.160.42.113 - - [16/Sep/2010:04:33:08 +0000] "GET /pixel HTTP/1.1" 200 2 "url" "Mozilla/5.0 (Windows; U; Windows NT 5.1; hu; rv:1.9.2.9) Gecko/20100824 Firefox/3.6.9 ( .NET CLR 3.5.30729)"
10.160.42.113 - - [16/Sep/2010:04:33:08 +0000] "POST /pixel HTTP/1.1" 200 2 "url" "Mozilla/5.0 (Windows; U; Windows NT 5.1; hu; rv:1.9.2.9) Gecko/20100824 Firefox/3.6.9 ( .NET CLR 3.5.30729)"

Here is the js code:

var iframe = document.createElement("iframe");
iframe.height = "0";
iframe.width = "0";
iframe.frameBorder = "0";
document.getElementById('canvas').appendChild(iframe);


var iframeDocument = iframe.contentDocument || iframe.contentWindow.document || iframe.document;
iframeDocument.open();
iframeDocument.close();


var form = document.createElement("form");
form.setAttribute("action", 'url');
form.setAttribute("method", 'POST');

for (var key in params) {
    var hiddenField = document.createElement("input");
    hiddenField.setAttribute("type", "hidden");
    hiddenField.setAttribute("name", key);
    hiddenField.setAttribute("value", params[key]);

    form.appendChild(hiddenField);
}

iframeDocument.body.appendChild(form);
form.submit();
+3
source share
2 answers

, " " . . GET POST, .

CORS -.

+1

- , - , "/" ? , "" , .

0

Source: https://habr.com/ru/post/1765023/


All Articles