Method and apparatus for distributed emulation of behavior of a malicious domain
Methods and apparatuses for enabling compatibility between multiple versions of an application programming interface (API) are described. When a first API request is received at a compute server, the compute server determines whether the first API request is of a first version of an API that is different from a second version of the API used in an origin server to which the first API request is destined. In response to determining that the first API request is of the first version of the API that is different from the second version of the API used in the origin server to which the first API request is destined, an API compatibility enabler is executed to convert the first API request into a second API request in the second version of the API. The second API request is fulfilled instead of the first API request.
1. A method comprising:
receiving, at a first compute server of a plurality of compute servers, a first Application Programming Interface (API) request from a client device, wherein the first API request is directed to an origin server, wherein the plurality of compute servers are part of a distributed cloud computing platform and have a same anycast Internet Protocol (IP) address fora domain of the origin server, and wherein the first compute server is a closest one of the compute servers to the client device as determined by an anycast implementation;
determining, at the first compute server, that the first API request is of a first version of an API that is different from a second version of the API used in the origin server; and
responsive to determining that the first API request is of the first version of the API that is different from the second version of the API used in the origin server:
converting, in one of a plurality of isolated execution environments that is not a container or a virtual machine and is at the first compute server, the first API request into a second API request in the second version of the API, and
fulfilling the second API request instead of the first API request, wherein the plurality of isolated execution environments run at a same time within a single process.
2. The method of claim 1 , further comprising:
receiving, in response to the second API request, a first API response; and
responsive to determining that the first API response is of the second version of the API:
converting, in one of a plurality of isolated execution environments at the first compute server, the first API response into a second API response in the first version of the API, and
transmitting the second API response to the client device.
3. The method of claim 2 , wherein the first API request is different from the second API request and the first API response is identical to the second API response.
4. The method of claim 1 wherein the first API request includes a first version identifier identifying the first version of the API to which the first API request belongs.
5. The method of claim 4 , wherein the determining that the first API request is of the first version of the API that is different from the second version of the API is performed based on the first version identifier and a set of one or more version identifiers uniquely identifying one or more versions of the API that are stored at the origin server.
6. The method of claim 1 , wherein the first API request triggers execution of an API compatibility enabler to convert the first API request into the second API request in the second version of the API, and wherein the API compatibility enabler can be configured via a control server.
7. The method of claim 1 , wherein the first API request includes a set of one or more fields, and wherein converting the first API request into the second API request in the second version of the API includes at least one of removing a first field from the set of fields, adding a second field to the set of fields, modifying a name of a third field from the set of fields, and modifying a type of a fourth field from the set of fields.
8. A non-transitory machine-readable storage medium of a first one of a plurality of compute servers that provides instructions that, when executed by a processor, cause the processor to perform operations comprising:
receiving, at a first compute server of a plurality of compute servers, a first Application Programming Interface (API) request from a client device, wherein the first API request is directed to an origin server, wherein the plurality of compute servers are part of a distributed cloud computing platform and have a same anycast Internet Protocol (IP) address fora domain of the origin server, and wherein the first compute server is a closest one of the compute servers to the client device as determined by an anycast implementation;
determining, at the first compute server, that the first API request is of a first version of an API that is different from a second version of the API used in the origin server; and
responsive to determining that the first API request is of the first version of an API that is different from the second version of the API used in the origin server:
converting, in one of a plurality of isolated execution environments that is not a container or a virtual machine and is at the first compute server, the first API request into a second API request in the second version of the API, and
fulfilling the second API request instead of the first API request, wherein the plurality of isolated execution environments run at a same time within a single process.
9. The non-transitory machine-readable storage medium of claim 8 , wherein the operations further comprise:
receiving, in response to the second API request, a first API response; and
responsive to determining that the first API response is of the second version of the API:
converting, in one of a plurality of isolated execution environments at the first compute server, the first API response into a second API response in the first version of the API, and
transmitting the second API response to the client device.
10. The non-transitory machine-readable storage medium of claim 9 , wherein the first API request is different from the second API request and the first API response is identical to the second API response.
11. The non-transitory machine-readable storage medium of claim 8 , wherein the first API request includes a first version identifier identifying the first version of the API to which the first API request belongs.
12. The non-transitory machine-readable storage medium of claim 11 , wherein the determining that the first API request is of the first version of the API that is different from the second version of the API is performed based on the first version identifier and a set of one or more version identifiers uniquely identifying one or more versions of the API that are stored at the first compute server.
13. The non-transitory machine-readable storage medium of claim 8 , wherein the first API request triggers execution of an API compatibility enabler to convert the first API request into the second API request in the second version of the API, and wherein the API compatibility enabler can be configured via a control server.
14. The non-transitory machine-readable storage medium of claim 8 , wherein the first API request includes a set of one or more fields, and wherein converting the first API request into the second API request in the second version of the API includes at least one of removing a first field from the set of fields, adding a second field to the set of fields, modifying a name of a third field from the set of fields, and modifying a type of a fourth field from the set of fields.
15. A compute server comprising:
a set of one or more processors; and
a non-transitory machine-readable storage medium that provides instructions that, when executed by the set of processors, cause the set of processors to perform the following operations:
receiving, at a first compute server of a plurality of compute servers, a first Application Programming Interface (API) request from a client device, wherein the first API request is directed to an origin server, wherein the plurality of compute servers are part of a distributed cloud computing platform and have a same anycast Internet Protocol (IP) address for a domain of the origin server, and wherein the first compute server is a closest one of the compute servers to the client device as determined by an anycast implementation;
determining, at the first compute server, that the first API request is of a first version of an API that is different from a second version of the API used in the origin server; and
responsive to determining that the first API request is of a first version of an API that is different from a second version of the API used in the origin server:
converting, in one of a plurality of isolated execution environments that is not a container or a virtual machine and is at the first compute server, the first API request into a second API request in the second version of the API, and
fulfilling the second API request instead of the first API request, wherein the plurality of isolated execution environments run at a same time within a single process.
16. The compute server of claim 15 , wherein the instructions, when executed by the set of processors, further cause the set of processors to perform the following operations:
receiving, in response to the second API request, a first API response; and
responsive to determining that the first API response is of the second version of the API:
converting, in one of a plurality of isolated execution environments at the first compute server, the first API response into a second API response in the first version of the API, and
transmitting the second API response to the client device.
17. The compute server of claim 16 , wherein the first API request is different from the second API request and the first API response is identical to the second API response.
18. The compute server of claim 15 , wherein the first API request includes a first version identifier identifying the first version of the API to which the first API request belongs.
19. The compute server of claim 18 , wherein the determining that the first API request is of the first version of the API that is different from the second version of the API is performed based on the first version identifier and a set of one or more version identifiers uniquely identifying one or more versions of the API that are stored at the first compute server.
20. The compute server of claim 15 , wherein the first API request triggers execution of an API compatibility enabler to convert the first API request into the second API request in the second version of the API, and wherein the API compatibility enabler can be configured via a control server.
21. The compute server of claim 15 , wherein the first API request includes a set of one or more fields, and wherein converting the first API request into the second API request in the second version of the API includes at least one of removing a first field from the set of fields, adding a second field to the set of fields, modifying a name of a third field from the set of fields, and modifying a type of a fourth field from the set of fields.