# Patent

## Title
Method, intermediate device and computer program code for maintaining persistency

## Abstract

A method for maintaining server persistency, including: (a) receiving, by an intermediate entity, a first session request from client to receive a service from a server out of a plurality of servers that are connected to the intermediate entity; (b) selecting a server out of the plurality of servers and directing to the selected server information indicative of the first session request; (c) receiving a response of the selected server to the information indicative of the first session request; (d) analyzing the response of the selected server, to provide an analysis result indicative whether the response includes code to be executed by the client and includes at least one instruction that facilitates sending, by the client, another request, to receive a service from a server out of the plurality of servers; (e) modifying, based on the analysis result, the code by adding information that will cause the client to send a selected server identifier in association to the sending of the other request; and (f) sending a modified response to the client, wherein the modified response includes the modified code.

## Background
FIELD OF THE INVENTION
This application relates to dynamically changing browser code by an intermediate unit and especially relates to a method, an intermediate device and a computer program code for maintaining server persistency.
BACKGROUND OF THE INVENTION
Maintaining server persistency in web-based environment is a well known requirement for every web-based property that would like to maintain clients' sessions' context for environments with multiple identical web-servers, as the underline HTTP protocol is stateless by its nature. This mechanism is usually implemented by Application Delivery Controller (ADC) internal or external to the servers. One of the main duties of ADC is to balance the load between multiple, function-identical servers. With ADC, these servers look like a single high-powered computing resource that allows many clients to access it simultaneously, and then balances the load between these function-identical web-servers. Few existing load-balancing mechanisms are known in the art and will not be described by this paper. When an ADC is configured to work with persistency, it guarantees that client's consecutive requests which belong to the same session will follow the same destination server as the first session request. The following main techniques are available today for achieving this functionality: (i) maintaining session persistency by source IP address, (ii) maintaining session persistency by HTTP session cookie, (iii) Maintaining session persistency by adding session identifier to URI part of the URL; and (IV) maintaining session persistency using a URL identifier.
Maintaining session persistency by source IP address—in this case the ADC looks for the source IP address of the client (the source IP address appears in every TCP/IP packet that carries HTTP traffic) and forwards all the requests which are coming from the same IP address to the same destination web-server. This method is poorly working when many users are accessing the same web-based application through Mega-Proxy server(s) (e.g. AOL service provider users). Mega-Proxy/proxy server replaces the client source IP addresses with its own addresses pool, thus forcing the ADC to forward all the clients to the same web-server, thus creating unbalanced environment.
Maintaining session persistency by HTTP session cookie—cookie is a well-know mechanism for maintaining session states by the web-server. When a web-server sets a session cookie in a response to a client request, the client is forced (by his/her browser software) to send this cookie header for every consecutive request to the same domain/site during that session. An ADC which sits between the server and the client can trace/modify/add a dedicated cookie header on the server response, in-order to signal itself to which server to forward the next requests from that particular client on the way back. Although this method is commonly used, it doesn't solve the issue of persistency when cookie mechanism is disabled by the client. A description of this method can be found in U.S. Pat. No. 6,473,802 which is incorporated herein by reference.
Maintaining session persistency by adding a session identifier to URI part of URL—when cookie isn't supported by the client, the web-server (by adjusting its code) can add session identifier to the URI part of the URL in every HTML response it sends. The ADC then traces the session identifier on the server response and saves this information in its internal memory together with the identifier of the server from which the response has come. Upon receiving the next request from the client, the ADC matches the URL identifier with those which are stored in its memory and forwards the request to the designated server which appears in its memory. This method will only work when the server code is adjusted to add URL identifier for every URL in the HTML response, and it significantly increases the processing overhead of the web-server. The method of maintaining session persistency without client supported cookie is described by U.S. Pat. No. 7,296,076 of Portolani which is incorporated herein by reference.
Maintaining session persistency using a URL identifier—this method is a combination of methods 2 and 3 above, whether or not the client supports cookie, the persistency is achieved by adding server identifier to every URL in the HTML server response. On the first client's request the ADC selects one server out of plurality of servers according to its load-balancing algorithm, and then later adds this server identifier to all the URLs which appear on the server's HTML response. The next coming requests from this particular client will include the server identifier, as part of the URL, to which the request should be forwarded to; the ADC then deletes this identifier, to prevent unexpected server behavior, and forwards the request according to the deleted server identifier value. An example of how to maintain persistency using URL identifier can be found in US patent application publication serial number 2003/0163586 of Schnetzler.
Method 4 above, does not address the issue of persistency in modern web-based environments where server's responses include browser code program, such as Java Script, Flash, Silverlight, AJAX, etc. These browser codes hide the URLs that will be sent by the client's browser program in a non-standard way, e.g. every browser code programmer can select his/her own way of writing the code, making the response URL modification task impossible.
SUMMARY THE INNOVATION
The present invention provides methods and intermediate devices as described in the accompanying claims. Specific embodiments of the invention are set forth in the dependent claims. These and other aspects of the invention will be apparent from and elucidated with reference to the embodiments described hereinafter.
The present invention provides methods and intermediate devices as described in the accompanying claims. Specific embodiments of the invention are set forth in the dependent claims. These and other aspects of the invention will be apparent from and elucidated with reference to the embodiments described hereinafter.
A method for maintaining server persistency, the method includes: receiving, by an intermediate entity, a first session request from client to receive a service from a server out of a plurality of servers that are coupled to the intermediate entity; selecting a server out of the plurality of servers and directing to the selected server information indicative of the first session request; receiving a response of the selected server to the information indicative of the first session request; analyzing the response of the selected server, to provide an analysis result indicative whether the response comprises code to be executed by the client and comprises at least one instruction that facilitates sending, by the client, another request to receive a service from a server out of the plurality of servers of the same site (plurality of servers that reside on the same site); modifying, in response to the analysis result, the code by adding information that will cause the client to send a selected server identifier in association to the sending of the other request; and sending a modified response to the client, wherein the modified response comprises the modified code.
The method can include analyzing the response of the selected server to locate browser code to be executed by a browser of the client.
The method can include analyzing the response of the selected server to locate at least one instruction that is executed by a browser of the client and includes a call to an entity to enable sending the other request, wherein the entity is selected from a group consisting of an operating system of the client and an API layer between the browser code and the operating system of the client.
The method can include adding an HTTP header for each call instruction of the code, wherein each HTTP header includes the selected server identifier, if the other request and the modified response are associated with a same site.
The method can include receiving, by the intermediate node, the other request from the client; removing the selected server identifier to provide a modified other request; and sending to the selected server information indicative of the modified other request.
The method can include receiving a selected server response that includes compressed code; de-compressing the compressed code to provide de-compressed code; wherein the analyzing includes analyzing the de-compressed code; wherein the modifying includes modifying, in response to the analysis result, the de-compressed code by adding information that will cause the client to send a selected server identifier in association to the sending of the other request; compressing the modified de-compressed code to provide a compressed modified code; and sending a modified response to the client, wherein the modified response includes the compressed modified code.
The method can include receiving a selected server response that includes encrypted code; decrypting the encrypted code to decrypted code; wherein the analyzing includes analyzing the decrypted code; wherein the modifying includes modifying, in response to the analysis result, the decrypted code by adding information that will cause the client to send a selected server identifier in association to the sending of the other request; encrypting the modified decrypted code to provide an encrypted modified code; and sending a modified response to the client, wherein the modified response includes the encrypted modified code.
The method can include modifying, in response to the analysis result, the code by adding information that will cause the client to send a selected server identifier in association to the sending of the other request if the other request and the modified response are associated with a same site.
An intermediate device, including: a client interface configured to receive a first session request from client to receive a service from a server out of a plurality of servers; a server selector configured to select a server out of the plurality of servers; a server interface, coupled to the plurality of servers and configured to direct to the selected server information indicative of the first session request and to receive a response of the selected server to the information indicative of the first session request; an analyzer configured to analyze the response of the selected server, to provide an analysis result indicative whether the response includes code to be executed by the client and includes at least one instruction that facilitates sending, by the client, another request to receive a service from a server out of the plurality of servers; a modifier configured to modify, in response to the analysis result, the code by adding information that will cause the client to send a selected server identifier in association to the sending of the other request and wherein the client interface is further adapted to send a modified response to the client, wherein the modified response includes the modified code.
The analyzer is configured to analyze the response of the selected server to locate browser code to be executed by a browser of the client.
The analyzer is configured to analyze the response of the selected server to locate at least one instruction that is executed by a browser of the client and includes a call to an entity to enable sending the other request, wherein the entity is selected from a group consisting of an operating system of the client and an API layer between the browser code and the operating system of the client.
The modifier is configured to add an HTTP header for each call instruction of the code, if the other request and the modified response are associated with a same site, wherein each added HTTP header includes the selected server identifier.
The client interface is configured to receive, by the intermediate node, the other request from the client; wherein the modifier is configured to remove the selected server identifier to provide a modified other request; and the client interface is configured to send to the selected server information indicative of the modified other request.
The intermediate device can include a de-compressor and a compressor; wherein the server interface is configured to receive a selected server response that includes compressed code; wherein the de-compressor is configured to de-compress the compressed code to provide decompressed code; wherein the compressor is configured to compress decompressed modified code received from the modifier to provide a compressed modified code; and wherein the client interface is configured to send a modified response to the client, wherein the modified response includes the compressed modified code.
The intermediate device can include a decryptor and a encryptor; wherein the server interface is configured to receive a selected server response that includes encrypted code; wherein the decryptor is configured to decrypt the encrypted code to provide decrypted code; wherein the encryptor is configured to decrypt decrypted modified code received from the modifier to provide an encrypted modified code; and wherein the client interface is configured to send a modified response to the client, wherein the modified response includes the encrypted modified code.
The intermediate device can include a modifier that is configured to modify, in response to the analysis result, the code by adding information that will cause the client to send a selected server identifier in association to the sending of the other request if the other request and the modified response are associated with a same site.
A computer program product that includes a computer readable medium that stores instructions for: receiving, by an intermediate entity, a first session request from client to receive a service from a server out of a plurality of servers that are coupled to the intermediate entity; selecting a server out of the plurality of servers and directing to the selected server information indicative of the first session request; receiving a response of the selected server to the information indicative of the first session request; analyzing the response of the selected server, to provide an analysis result indicative whether the response includes code to be executed by the client and includes at least one instruction that facilitates sending, by the client, another request to receive a service from a server out of the plurality of servers of the same site; modifying, in response to the analysis result, the code by adding information that will cause the client to send a selected server identifier in association to the sending of the other request and sending a modified response to the client, wherein the modified response includes the modified code.
The computer program product can include a computer readable medium that stores instructions for analyzing the response of the selected server to locate browser code to be executed by a browser of the client.
The computer program product can include a computer readable medium that stores instructions for analyzing the response of the selected server to locate at least one instruction that is executed by a browser of the client and includes a call to an operating system of the client to enable sending the other request.
The computer program product can include a computer readable medium that stores instructions for adding an HTTP header for each call instruction of the code, if the other request and the modified response are associated with a same site, wherein each HTTP header includes the selected server identifier.
The computer program product can include a computer readable medium that stores instructions for: receiving, by the intermediate node, the other request from the client; removing the selected server identifier to provide a modified other request; and sending to the selected server information indicative of the modified other request.
The computer program product can include a computer readable medium that stores instructions for: receiving a selected server response that includes compressed code; de-compressing the compressed code to provide de-compressed code; analyzing the de-compressed code; modifying, in response to the analysis result, the de-compressed code by adding information that will cause the client to send a selected server identifier in association to the sending of the other request; compressing the modified de-compressed code to provide a compressed modified code; and sending a modified response to the client, wherein the modified response includes the compressed modified code.
The computer program product can include a computer readable medium that stores instructions for: receiving a selected server response that includes encrypted code; decrypting the encrypted code to decrypted code; analyzing the decrypted code; modifying, in response to the analysis result, the decrypted code by adding information that will cause the client to send a selected server identifier in association to the sending of the other request; encrypting the modified decrypted code to provide an encrypted modified code; and sending a modified response to the client, wherein the modified response includes the encrypted modified code.
The computer program product can include a computer readable medium that stores instructions for modifying, in response to the analysis result, the code by adding information that will cause the client to send a selected server identifier in association to the sending of the other request if the other request and the modified response are associated with a same site.



BRIEF DESCRIPTION OF THE DRAWINGS
Further details, aspects, and embodiments of the invention will be described, by way of example only, with reference to the drawings.
FIG. 1 illustrates an intermediate entity such as application delivery controller, clients, network and multiple servers according to an embodiment of the invention;
FIG. 2 illustrates a method for maintaining server persistency, according to an embodiment of the invention.
FIG. 3 illustrates a method according to an embodiment of the invention; and
FIG. 4 illustrates a method according to an embodiment of the invention.



DETAILED DESCRIPTION OF THE DRAWINGS
Because the apparatus implementing the present invention is, for the most part, composed of electronic components and circuits known to those skilled in the art, circuit details will not be explained in any greater extent than that considered necessary as illustrated above, for the understanding and appreciation of the underlying concepts of the present invention and in order not to obfuscate or distract from the teachings of the present invention.
In the following specification, the invention will be described with reference to specific examples of embodiments of the invention. It will, however, be evident that various modifications and changes may be made therein without departing from the broader spirit and scope of the invention as set forth in the appended claims.
It has been shown that persistency can be maintained when a server response includes client code. By modifying the code the client, when executing the code, sends in association with a request to obtain a service from a server, a server identifier that identifies the server that was selected to provide a response.
Conveniently, the method can be executed without using dedicated HTTP cookies.
According to an embodiment of the invention, on the first client request (to receive a service from a server) an intermediate entity (such as but not limited to an application delivery controller—ADC) selects a selected server (for example-by applying a load balancing algorithm) to which the request should be forwarded to. When the response of the selected server (selected server response) is received by the intermediate entity it analyzes the response to determine whether a certain code is included in the server response (The certain code includes one or more instructions that facilitate sending, by the client, another request to receive a service from a server out of the plurality of servers of the same site). If the answer is negative the response is sent (conveniently without being modified) to the client. If the analysis indicates that the selected server response includes the certain code then the intermediate entity modifies that certain code by adding information that will cause the client to send a selected server identifier in association to the sending of the other request. A modified response that includes the modified code is sent to the client.
FIG. 1 illustrates an intermediate device such as application delivery controller (ADC) 100, clients 10(1)-10(n), network 20, and multiple servers 30(1)-30(k), according to an embodiment of the invention.
ADC 100 is connected to multiple servers 30(1)-30(k) via server interface 120 and is connected via client interface 110 and network 20 to clients 10(1)-10(n).
ADC 100 includes, in addition to server interface 120 and client interface 110, server selector 130, analyzer 140, modifier 150, decryptor 160, encryptor 170, de-compressor 180 and compressor 190. It is noted that each of these modules can include hardware, software or a combination thereof. It is further noted that some modules (such as decryptor 160, encryptor 170, de-compressor 180 and compressor 190) are optional.
Client interface 110 receives a request from a client to receive a service from a server out of servers 30(1)-30(k). After a connection was established with a client, that client can send a first session request (which conveniently refers to the first session request of a client session) or additional session requests. A first session request after the establishment of the session requires an allocation of a server out of servers 30(1)-30(k) while other requests follow the allocation. The other requests include a unique server identifier that is indicative of a server (out of servers 30(1)-30(k) that was previously selected by ADC 100. The client sends the unique server identifier inside the following requests based on the modified response code that was sent to it by ADC 100.
The service requested by the client can involve sending information to the client from the server, executing a program by the server, sending to the client web pages, and the like.
In order to determine whether a received request is the first session request, client interface 110 sends it to analyzer 140.
Analyzer 140 that can determine whether a server was already assigned to respond to the client by searching the unique server identifier. If such unique server identifier exists, ADC 100 sends the request to the selected server associated with the unique server identifier; otherwise, the request is sent to server selector 130.
Server selector 130 is configured to select a server out of plurality of servers 30(1)-30(k). It can apply a load balancing algorithm, but this is not necessarily so.
Once the selection of the selected server is made, server selector 130 sends an indication to server interface 120 that directs information indicative of the first session request to the selected server. The information can be the first session request itself but this is not necessarily so.
The selected server (out of servers 30(1)-30(k)) then sends to ADC 100 a selected server response (responsive to the information sent from ADC 100) that is received by server interface 120.
The selected server response is sent to analyzer 140 that is configured to analyze the response of the selected server and to provide an analysis result. The analysis result indicates the selected server response includes code to be executed by the client and includes at least one instruction that facilitates sending, by the client, another request to receive a service from a server out of the plurality of servers. If such a code is included in the selected server response than the code is sent to modifier 150.
Analyzer 140 can include an application parser engine that parses the code as well as determines whether the code should de-compressed (by de-compressor 180) or decrypted (by decryptor 160) before being modified by modifier 150.
Modifier 150 is configured to modify the code, in response to the analysis result, by adding information that will cause the client to send a selected server identifier in association to the sending of the other request. According to an embodiment of the invention, modifier 150 is configured to modify, in response to the analysis result, the code by adding information that will cause the client to send the selected server identifier in association to the sending of the other request if it is destined to the same site from which the modified response has been received. Modifier 150 can include a browser code engine that can amend the code to include information that will cause the client to send a selected server identifier in association to the sending of the other request. The information can include one or more instructions, one of more data fields (such as a HTTP header) and the like. Modifier can include a browser code engine that can add a HTTP ServerID header to the browser code, whenever the browser code sends request to a web site that can be serviced by the selected browser.
Modifier 150 can, for example, parse the browser code and mark all the locations where the browser should call the client's operating system (or an API layer between the browser code and the operating system of the client) for sending HTTP requests. In these locations modifier 150 adds a unique HTTP header for each of these calls that will be sent to the client with the next requests and includes a selected server identifier that will signal to ADC 100 which is the selected server. According to an embodiment of the invention, the modifier adds the HTTP header if the request is destined to the same site from which the modified response has been received.
It is noted that, conveniently, the modification of the code is only applied to the cases where the browser code sends request to the site where the ADC is installed. When the code sends requests to other sites the code modification is conveniently not applied.
Modifier 150 outputs a modified response that is sent by client interface 110 to the client.
Modifier 150 can be configured to modify the code, in response to the analysis result, by adding information that will cause the client to send a selected server identifier in association to the sending of the other request if the other request and the modified response are associated with the same site (or group of associated addresses). For example—if the other request is destined to the site from which the modified response has been received.
According to various embodiments of the invention ADC 100 also includes decryptor 160, encryptor 170, de-compressor 180 and compressor 190.
Decryptor 160 can decrypt an encrypted selected server response or at least an encrypted code within the selected server response to provide a decrypted code. The decrypted code can then be sent to analyzer 140 and/or to modifier 150. Encryptor 170 can encrypt a modified response or at least a modified code. The encrypted modified code can then be sent (within a modified response) to the client.
Decryptor 160 and encryptor 170 can be included within an SSL Engine, but this is not necessarily so.
De-compressor 180 can de-compress a compressed selected server response or at least a compressed code within the selected server response to provide a de-compressed code. The de-compressed code can then be sent to analyzer 140 and/or to modifier 150. Compressor 190 can compress a modified response or at least a modified code. The compressed modified code can then be sent (within a modified response) to the client.
It is noted that ADC 100 can apply both compression and encryption of code. For example, it can decrypt and de-compress code and send it to modifier 150 (or analyzer 140) and then compress and encrypt the modified code.
ADC 100 can include additional modules such as communication modules (including but not limited to a L2 switching module, an L3 routing module, a TCP termination engine) responsive to managing the communication between clients and servers.
According to various embodiments of the invention ADC 100 can also apply at least one prior art method for managing requested server requests that do not include code. It can, for example, maintain session persistency by using a URL identifier.
FIG. 2 illustrates method 200 for maintaining server persistency, according to an embodiment of the invention.
Method 200 starts by stage 210 of receiving, by an intermediate entity, from a client a request to receive a service from a server out of a plurality of servers. The intermediate entity is connected between one or more clients and one or more servers.
Stage 210 is followed by stage 240 of determining whether to select a server out of the multiple servers or not. Stage 240 includes determining whether the request includes a server identifier that identifies one of the multiple servers. If such an identifier exists then information representing the request is sent to that server. This can occur if the request is not the first session request from the client after a session with the client was established—where a selection of a selected server has already occurred.
If the answer is positive—a server identifier exists—then stage 240 is followed by stage 260 of sending information representative of the request to the selected server. Stage 260 can also include removing the server identifier before sending the information to the selected server.
If the answer is negative—a server identifier does not exist—then stage 240 is followed by stage 250 of selecting a server out of the plurality of servers. Stage 250 is followed by stage 260 of sending to the selected server information indicative of the request.
Stage 260 is followed by stage 270 of receiving, by the intermediate entity, a selected server response—a response of the selected server to the information indicative of the request.
Stage 270 is followed by stage 280 of analyzing the response of the selected server, to provide an analysis result indicative whether the response includes code to be executed by the client and whether the code includes at least one instruction that facilitates sending, by the client, another request to receive a service from a server out of the plurality of servers. If the answer to both questions is positive then stage 280 is followed by stage 290. Else, stage 280 is followed by stage 300 of sending a response to the client.
Stage 280 of analyzing can include locating browser code to be executed by a browser of the client and especially (but not solely) locating at least one instruction that is executed by a browser of the client and includes a call to an operating system of the client to enable sending the other request. The call can be in the form of a send instruction. According to an embodiment of the invention, the call is a call to an entity to enable sending the other request, wherein the entity is selected from a group consisting of an operating system of the client and an API layer between the browser code and the operating system of the client.
Stage 290 includes modifying the code by adding information that will cause the client to send a selected server identifier in association to the sending of the other request. It is noted that according to an embodiment of the invention, the modifying is carried out if the other request is destined to the site from which the modified response has been received.
Stage 290 can include adding an HTTP header for each call instruction of the code, wherein each HTTP header comprises the selected server identifier. According to an embodiment of the invention, the adding of the HTTP header is carried out if the other request is destined to the same site from which the modified response has been received.
It should be noted that conveniently, the modification of the code is only applied to the cases where the browser code sends request to the site where the ADC is installed. When the code sends requests to other sites, the code modification is conveniently not applied.
Stage 290 is followed by stage 310 of sending a modified response to the client, wherein the modified response includes the modified code.
If the request sent by the client is the first session request to receive a service then it is processed by the following stages: (i) receiving, by an intermediate entity, a first session request from client to receive a service from a server out of a plurality of servers that are coupled to the intermediate entity; (ii) selecting a server out of the plurality of servers and directing to the selected server information indicative of the first session request; (iii) receiving a response of the selected server to the information indicative of the first session request; (iv) analyzing the response of the selected server, to provide an analysis result indicative whether the response comprises code to be executed by the client and comprises at least one instruction that facilitates sending, by the client, another request to receive a service from a server out of the plurality of servers; (v) modifying, based on the analysis result (if such a code exists), the code by adding information that will cause the client to send a selected server identifier in association to the sending of the other request; and (vi) sending a modified response to the client, wherein the modified response comprises the modified code.
According to an embodiment of the invention stage 300 can be preceded by stage 292 of modifying URLs included in the selected server response in order to identify the selected server. The modification can include, for example, adding a unique server identifier to the URI of the URL of an HTML response sent to the client. It is noted that in this case the response can include a session identifier (instead of the unique server identifier) that can be mapped, by the intermediate entity to a selected server. In this case the session identifier can be modified.
It should be noted that, according to an embodiment of the invention, in relation to responses which are not a browser code, a wrapper takes every response which isn't a browser code and add to it a wrapper that implement the above, i.e. for every consecutive request that is sent to the server the browser code wrapper adds an HTTP header with ServerID.
FIG. 3 illustrates method 400 according to an embodiment of the invention.
Method 400 differs from method 200 by including stages 410, 420 and 430.
Stage 410 is preceded by stage 210 and is followed by stage 240. Stage 410 includes decoding an encrypted request of the client. Stage 410 can also include decrypting the entire request or a portion thereof.
Stage 420 is preceded by stage 270 and is followed by stage 280. It includes decrypting an encrypted code to provide a decrypted code. The encrypted code is included in a selected server response and stage 420 can include decrypting the selected server response or a portion thereof.
Stage 430 is preceded by stage 290 and is followed by stage 310. It includes encrypting a decrypted code to provide an encrypted code. Stage 430 can also include encrypting the selected server response or a portion thereof. Stage 430 may also be preceded by stage 292 and followed by stage 300.
Applying method 400 can involve: (i) receiving a selected server response that includes encrypted code; (ii) decrypting the encrypted code to provide a decrypted code. In this caste the stage of analyzing includes analyzing the decrypted code and the stage of modifying includes modifying, in response to the analysis result, the decrypted code by adding information that will cause the client to send a selected server identifier in association to the sending of the other request; (iii) encrypting the modified decrypted code to provide an encrypted modified code; and (iv) sending a modified response to the client, wherein the modified response comprises the encrypted modified code.
FIG. 4 illustrates method 500 according to an embodiment of the invention.
Method 500 differs from method 200 by including stages 510, 520 and 530.
Stage 510 is preceded by stage 210 and is followed by stage 240. Stage 510 includes de-compressing a compressed request of the client. Stage 510 can also include de-compressing the entire request or a portion thereof
Stage 520 is preceded by stage 270 and is followed by stage 280. It includes de-compressing a compressed code to provide a de-compressed code. Stage 520 can also include de-compressing the selected server response or a portion thereof.
Stage 530 is preceded by stage 290 and is followed by stage 310. It includes compressing a de-compressed code to provide a compressed code. Stage 530 can also include compressing the selected server response/modified response or a portion thereof. Stage 530 may also be preceded by stage 292 and followed by stage 300.
Method 500 can include: receiving a selected server response that comprises compressed code; de-compressing the compressed code to provide de-compressed code; wherein the analyzing comprises analyzing the de-compressed code; wherein the modifying comprises modifying, based on the analysis result, the de-compressed code by adding information that will cause the client to send a selected server identifier in association to the sending of the other request; compressing the modified de-compressed code to provide a compressed modified code; and sending a modified response to the client, wherein the modified response comprises the compressed modified code.
According to an embodiment of the invention, an example for modifying java-script based browser code is provided:

    
    
        a. Before:
        
            objHTTP=new ActiveXObject(‘Microsoft.XMLHTTP’);
            objHTTP.open(‘POST’,“OtherPage.asp”,false);
            objHTTP.setRequestHeader(‘Accept-Encoding’,‘gzip, deflate’);
            objHTTP.send
        
        
        b. After:
        
            objHTTP=new ActiveXObject(‘Microsoft.XMLHTTP’);
            objHTTP.open(‘POST’,“OtherPage.asp”,false);
            objHTTP.setRequestHeader(‘Accept-Encoding’,‘gzip, deflate’);
            objHTTP.setRequestHeader(‘X-Cres-Session-ID’,‘persist-server-3004’);
            objHTTP.send
        
        
    
    


According to another embodiment of the invention any of the mentioned above methods, intermediate devices and computer program products can be aimed by a purpose that differs from maintaining a server's persistency. For example they can be applied for improving a user experience.
Conveniently, a combination of either one of the mentioned above methods can be provided. For example, decryption can be applied on client requests or on selected server responses, de-compression operations can be applied on selected server responses and code.
Because the apparatus implementing the present invention is, for the most part, composed of electronic components and circuits known to those skilled in the art, circuit details will not be explained in any greater extent than that considered necessary as illustrated above, for the understanding and appreciation of the underlying concepts of the present invention and in order not to obfuscate or distract from the teachings of the present invention.

## Claims

1. A method for maintaining server persistency, comprising:
receiving, by an intermediate entity, a first session request from client to receive a service from a server out of a plurality of servers that are coupled to the intermediate entity;
selecting a server out of the plurality of servers and directing to the selected server information indicative of the first session request;
receiving a response of the selected server to the information indicative of the first session request;
analyzing, by an analyzer of the intermediate entity, the response of the selected server, to provide an analysis result indicative whether the response comprises code to be executed by the client and comprises at least one instruction that facilitates sending, by the client, another request to receive a service from a server out of the plurality of servers;
wherein the analyzing comprises analyzing the response of the selected server to locate browser code to be executed by a browser of the client;
modifying, by a modifier of the intermediate entity, in response to the analysis result, the browser code by adding information to each call in the browser code that will cause the client to send a selected server identifier in association to the sending of the other request, wherein the browser code is parsed and marked at each location where each call is made to an operating system of the client for sending each request, and wherein the information added at each marked location for each call includes a unique HTTP header that includes the selected server identifier independent of a dedicated HTTP cookie; and
sending a modified response to the client, wherein the modified response comprises the modified browser code.

2. The method according to claim 1 wherein the method is executed without using dedicated HTTP cookies.

3. The method according to claim 1 comprising analyzing the response of the selected server to locate at least one instruction that is executed by a browser of the client and comprises a call to an entity to enable sending the other request, wherein the entity is selected from a group consisting of an operating system of the client and an API layer between the browser code and the operating system of the client.

4. The method according to claim 1 comprising adding the HTTP
header for each call instruction of the code, wherein each HTTP header comprises the selected server identifier, if the other request and the modified response are associated with a same site.

5. The method according to claim 1 comprising:
receiving, by the intermediate node, the other request from the client;
removing the selected server identifier to provide a modified other request; and
sending to the selected server information indicative of the modified other request.

6. The method according to claim 1 comprising:
receiving a selected server response that comprises compressed code;
de-compressing the compressed code to provide de-compressed code;
wherein the analyzing comprises analyzing the de-compressed code;
wherein the modifying comprises modifying, in response to the analysis result, the decompressed code by adding information that will cause the client to send the selected server identifier in association to the sending of the other request;
compressing the modified de-compressed code to provide a compressed modified code; and
sending a modified response to the client, wherein the modified response comprises the compressed modified code.

7. The method according to claim 1 comprising:
receiving a selected server response that comprises encrypted code;
decrypting the encrypted code to decrypted code;
wherein the analyzing comprises analyzing the decrypted code;
wherein the modifying comprises modifying, in response to the analysis result, the decrypted code by adding information that will cause the client to send the selected server identifier in association to the sending of the other request;
encrypting the modified decrypted code to provide an encrypted modified code; and
sending a modified response to the client, wherein the modified response comprises the encrypted modified code.

8. The method according to claim 1 comprising modifying, in response to the analysis result, the code by adding information that will cause the client to send the selected server identifier in association to the sending of the other request if the other request and the modified response are associated with a same site.

9. An intermediate device, comprising:
a client interface receiving a first session request from a client to receive a service from a server out of a plurality of servers;
a server selector selecting a server out of the plurality of servers;
a server interface, coupled to the plurality of servers, directing to the selected server information indicative of the first session request and to receive a response of the selected server to the information indicative of the first session request;
an analyzer analyzing the response of the selected server, to provide an analysis result indicative whether the response comprises code to be executed by the client and comprises at least one instruction that facilitates sending, by the client, another request to receive a service from a server out of the plurality of servers;
a modifier modifying, in response to the analysis result, browser code by adding information to each call in the browser code that will cause the client to send a selected server identifier in association to the sending of the other request, wherein the browser code is parsed and marked at each location where each call is made to an operating system of the client for sending each request, and wherein the information added at each marked location for each call includes a unique HTTP header that includes the selected server identifier independent of a dedicated HTTP cookie;
wherein the analyzer analyzes the response of the selected server to locate the browser code to be executed by a browser of the client; and
wherein the client interface further sends a modified response to the client, wherein the modified response comprises the modified browser code.

10. The intermediate device according to claim 9 does not utilize dedicated HTTP cookies.

11. The intermediate device according to claim 9 wherein the analyzer analyzes the response of the selected server to locate at least one instruction that is executed by a browser of the client and comprises a call to an entity to enable sending the other request, wherein the entity is selected from a group consisting of an operating system of the client and an API layer between the browser code and the operating system of the client.

12. The intermediate device according to claim 9 wherein the modifier adds the HTTP header for each call instruction of the code, if the other request and the modified response are associated with a same site, wherein each added HTTP header comprises the selected server identifier.

13. The intermediate device according to claim 9 wherein the client interface receives, by the intermediate node, the other request from the client; wherein the modifier removes the selected server identifier to provide a modified other request; and the client interface sends to the selected server information indicative of the modified other request.

14. The intermediate device according to claim 9 comprising a decompressor and a compressor; wherein the server interface receives a selected server response that comprises compressed code; wherein the de-compressor de-compresses the compressed code to provide decompressed code; wherein the compressor compresses decompressed modified code received from the modifier to provide a compressed modified code; and wherein the client interface sends a modified response to the client, wherein the modified response comprises the compressed modified code.

15. The intermediate device according to claim 9 comprising a decryptor and an encryptor; wherein the server interface receives a selected server response that comprises encrypted code; wherein the decryptor decrypts the encrypted code to provide decrypted code; wherein the encryptor decrypts decrypted modified code received from the modifier to provide an encrypted modified code; and wherein the client interface sends a modified response to the client, wherein the modified response comprises the encrypted modified code.

16. The intermediate device according to claim 9 wherein the modifier modifies, in response to the analysis result, the code by adding information that will cause the client to send the selected server identifier in association to the sending of the other request if the other request and the modified response are associated with a same site.

17. A computer program product that comprises a non-transitory computer readable medium that stores instructions for:
receiving, by an intermediate entity, a first session request from client to receive a service from a server out of a plurality of servers that are coupled to the intermediate entity;
selecting a server out of the plurality of servers and directing to the selected server information indicative of the first session request;
receiving a response of the selected server to the information indicative of the first session request;
analyzing, by an analyzer of the intermediate entity, the response of the selected server, to provide an analysis result indicative whether the response comprises code to be executed by the client and comprises at least one instruction that facilitates sending, by the client, another request to receive a service from a server out of the plurality of servers;
wherein the analyzing comprises analyzing the response of the selected server to locate browser code to be executed by a browser of the client;
modifying, by a modifier of the intermediate entity and in response to the analysis result, the browser code by adding information to each call in the browser code that will cause the client to send a selected server identifier in association to the sending of the other request and sending a modified response to the client, wherein the browser code is parsed and marked at each location where each call is made to an operating system of the client for sending each request, and wherein the modified response comprises the modified browser code, and wherein the information added at each marked location for each call includes a unique HTTP header that includes the selected server identifier independent of a dedicated HTTP cookie;
wherein the computer readable medium stores instructions for analyzing the response of the selected server to locate browser code to be executed by a browser of the client.

18. The computer program product according to claim 17 comprising a non-transitory computer readable medium that stores instructions for receiving, analyzing, modifying and sending without using dedicated HTTP cookies.

19. The computer program product according to claim 17 comprising a non-transitory computer readable medium that stores instructions for analyzing the response of the selected server to locate at least one instruction that is executed by a browser of the client and comprises a call to an operating system of the client to enable sending the other request.

20. The computer program product according to claim 17 comprising a non-transitory computer readable medium that stores instructions for adding the HTTP header for each call instruction of the code, if the other request and the modified response are associated with a same site, wherein each HTTP header comprises the selected server identifier.

21. The computer program product according to claim 17 comprising a non-transitory computer readable medium that stores instructions for:
receiving, by the intermediate node, the other request from the client;
removing the selected server identifier to provide a modified other request; and
sending to the selected server information indicative of the modified other request.

22. The computer program product according to claim 17 comprising a non-transitory computer readable medium that stores instructions for:
receiving a selected server response that comprises compressed code;
de-compressing the compressed code to provide de-compressed code;
analyzing the de-compressed code;
modifying, in response to the analysis result, the de-compressed code by adding information that will cause the client to send the selected server identifier in association to the sending of the other request;
compressing the modified de-compressed code to provide a compressed modified code; and
sending a modified response to the client, wherein the modified response comprises the compressed modified code.

23. The computer program product according to claim 17 comprising a non-transitory computer readable medium that stores instructions for:
receiving a selected server response that comprises encrypted code;
decrypting the encrypted code to decrypted code;
analyzing the decrypted code;
modifying, in response to the analysis result, the decrypted code by adding information that will cause the client to send the selected server identifier in association to the sending of the other request;
encrypting the modified decrypted code to provide an encrypted modified code; and
sending a modified response to the client, wherein the modified response comprises the encrypted modified code.

24. The computer program product according to claim 17 comprising a non-transitory computer readable medium that stores instructions for modifying, in response to the analysis result, the code by adding information that will cause the client to send the selected server identifier in association to the sending of the other request if the other request and the modified response are associated with a same site.