I have a little embedded website, where the user can send some data via an input form and an ajax request to my HTTP Server using Digest Authentication. My HTTP Server is limited to 1 TCP connection for HTTP requests. If the request is finished, another page is loaded with location.replace(newSite)
.
The Problem is, that after the first ajax request, Firefox wants to create a new TCP connection to the server, which is not possible and therefore it fails (I could see it in Wireshark). In Chrome everything works fine as it uses the same TCP connection.
The problem also occurs at the first ajax request, if the TCP connection from loading the site has not been closed yet.
Is there a way to tell Firefox via javascript that it either should close every connection immediatly after use, or (better) to use the same TCP connection for any ongoing requests?
I've tried "Connection":"close"
for the ajax request, but nothing changed. Besides, I cannot manipulatie location.replace
requests or URL requests directly typed to the address bar.
Thanks for your help.
The ajax request:
$.ajax({
url: "/res",
dataType: 'text',
cache: false,
async: true,
data: form_data,
contentType: false,
processData: false,
timeout: 300,
type: 'post',
headers: { 'Connection':'close' },
username: sUser,
password: sPass,
})
.done(function(data, textStatus, jqXHR){
window.location.replace("/site.html");
})
.fail(function( jqXHR, textStatus, errorThrown ){
alert("fail");
})
Is there a way to tell Firefox via javascript that it either should close every connection immediatly after use, or (better) to use the same TCP connection for any ongoing requests?
There is no way to instruct the client from the server to not use multiple parallel connections or that it should close the connection immediately after the response was received.
But one can close the connection at the server side after the response is done and thus force the client to open a new TCP connection for the next request.