Before serving the web page, I am checking some data on user's web browser using javascript. If it is found, then a token will be generated and the same request is made with an additional custom header 'X-Token'.
token = genTokenId(rdCookie('client_id'))
if (found == 1) {
xmlhttp = new XMLHttpRequest();
if (xmlhttp) {
xmlhttp.open(rdCookie('method'), rdCookie('url'), false);
xmlhttp.setRequestHeader("X-Token", token);
xmlhttp.onload = function(event) {
document.documentElement.innerHTML = xmlhttp.responseText;
xmlhttp.close();
}
xmlhttp.send();
} else {
alert("Error! Your browser is not supporting XMLHttpRequest")
}
}
This code will be delivered for any connection request made by a client. To resume the connection request with generated token this javascript carries "client_id", "url" and "method" in cookies. After generating Token-ID using "client_id", the same request is made using AJAX. Content is delivered successfully, If all web document is available in root directory. If it is in sub-directory, it returns HTTP 200 OK for first time, but return HTTP 404 Not Found for second request under same sub-directory.
For example, request to "/src/feedBackView.php" returns HTTP 200 OK, but subsequent request to "/src/feedBackControl.php" returns HTTP 404 Not Found.
After analyzing I understood, that the url bar is never getting updated during HTTP 302 and 200. Hence, instead of requesting "/src/feedBackControl.php" the browser requests only "feedBackControl.php" Please help me to fix it.
Aucun commentaire:
Enregistrer un commentaire